tmux-python / tmux-python/tmuxp

cmd.get("enter", enter) AttributeError: 'str' object has no attribute 'get'

Open
#980 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.6k
Forks
248
Avg merge
2h 13m
Merged PRs (30d)
1

Description

the code

from tmuxp.workspace.freezer import freeze
from tmuxp.workspace.builder import WorkspaceBuilder
from libtmux.server import Server

server = Server()
session = server.sessions.get(session_name="test", default=None)

if session:
    new_session = freeze(session)
    server.kill_session("test")
    builder = WorkspaceBuilder(session_config=new_session, server=server)
    builder.build()

error:

Traceback (most recent call last):
  File "/home/javier/dotfiles/bin/.bin/kitty-workspaces-d/test.py", line 12, in <module>
    builder.build()
    ~~~~~~~~~~~~~^^
  File "/home/javier/dotfiles/bin/.bin/kitty-workspaces-d/.venv/lib/python3.13/site-packages/tmuxp/workspace/builder.py", line 323, in build
    for pane, pane_config in self.iter_create_panes(window, window_config):
                             ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/javier/dotfiles/bin/.bin/kitty-workspaces-d/.venv/lib/python3.13/site-packages/tmuxp/workspace/builder.py", line 552, in iter_create_panes
    enter = cmd.get("enter", enter)
            ^^^^^^^
AttributeError: 'str' object has no attribute 'get'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the freeze-and-rebuild example, then inspect tmuxp/workspace/builder.py around iter_create_panes(), especially the cmd.get("enter", enter) call. Trace the frozen session data passed into WorkspaceBuilder and determine what input shape causes the AttributeError. Done means the reported example rebuilds the session without this exception, with coverage for the corrected behavior if the repository has a relevant test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.