Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
Javi3y opened this issue Apr 27, 2025 · 2 comments
Open

Comments

@Javi3y
Copy link

Javi3y commented Apr 27, 2025

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'

@tony
Copy link
Member

tony commented Apr 27, 2025

Can you show the new_session.

Does this work

import pprint

pprint.pprint(new_session)

@Javi3y
Copy link
Author

Javi3y commented Apr 27, 2025

{'session_name': 'test',
'windows': [{'focus': 'true',
'layout': 'ab5d,82x41,0,0,0',
'options': {},
'panes': [{'focus': 'true', 'shell_command': ['zsh']}],
'start_directory': '/home/javier',
'window_name': 'zsh'}]}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants