`TmuxObjectDoesNotExist` when creating `libtmux.Server().new_session(attach=True)`

Open
#502 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
api, cli

Research direction

Reproduce the failure with Server().new_session(attach=True) and inspect server.py, session.py, and neo.py at the stack-trace locations. Compare the session returned by tmux list-sessions with the identifier passed to Session.from_session_id, including tmux 3.0a and 3.3a behavior. Done means the reported command returns the created session without TmuxObjectDoesNotExist.

Written by the indexing model from the issue text.

Description

$ python3 -c 'import libtmux ; print(libtmux.Server().new_session(attach=True))'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/vadim/.cache/pypoetry/virtualenvs/robots-ml-agent-PwTI9jHQ-py3.8/lib/python3.8/site-packages/libtmux/server.py", line 493, in new_session
    return Session.from_session_id(
  File "/home/vadim/.cache/pypoetry/virtualenvs/robots-ml-agent-PwTI9jHQ-py3.8/lib/python3.8/site-packages/libtmux/session.py", line 85, in from_session_id
    session = fetch_obj(
  File "/home/vadim/.cache/pypoetry/virtualenvs/robots-ml-agent-PwTI9jHQ-py3.8/lib/python3.8/site-packages/libtmux/neo.py", line 240, in fetch_obj
    raise exc.TmuxObjectDoesNotExist(
libtmux.exc.TmuxObjectDoesNotExist: Could not find object

from pyproject.toml:
[tool.poetry.dependencies]
python = "^3.8"
libtmux = {git = "https://github.com/tmux-python/libtmux/"}
tmuxp = "^1.31.0"

$ tmux -V
tmux 3.0a

$ tmuxp -V
tmuxp 1.31.0, libtmux 0.23.2

$ apt-cache policy tmux
tmux:
  Installed: 3.0a-2ubuntu0.4
  Candidate: 3.0a-2ubuntu0.4
  Version table:
 *** 3.0a-2ubuntu0.4 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
        100 /var/lib/dpkg/status
     3.0a-2 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

locale
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=en_US.utf8

When I run this code, the session is created successfully (tmux opens up, there is a single window with text like $2 in it, closed upon enter, and then I have a shell) but libtmux does not seem to find it.

It's the same with tmux 3.3a from Linuxbrew.
When the session gets started:

tmux list-sessions
0: 1 windows (created Sat Oct 21 02:13:23 2023) (attached)
2: 1 windows (created Sat Oct 21 02:13:48 2023) (attached)
Dominant language
Python
Stars
1.2k
Forks
127
Avg merge
2h 13m
Merged PRs (30d)
1

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.

More from tmux-python/libtmux

All issues in tmux-python/libtmux

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.