Comments (14)
I'm trying to create a repro, will be in touch.
thanks, Brad
from libtmux.
I need to get back to this.... Will try next week. I few other things popped up that needed attention.
talk soon
from libtmux.
@cidrblock Thank you! If you could provide more of the traceback, I can give my full attention to it this weekend
tmux
version- full traceback (to see where in libtmux it's tripping up)
- a snippet of libtmux code where the error is happening (or perhaps linking to the code in the repo)
- steps to reproduce in ansible navigator (I assume its happening there)
- If time isn't a problem: Enough to reproduce it reliably and independent of ansible-navigator, if possible (if that's too intensive I can clone the repo and try to reproduce locally)
(TY for libtmux BTW, I'm not sure what we would do without it)
Thank you!
from libtmux.
Sounds good!
from libtmux.
@cidrblock This doesn't necessarily need a full reproduction (that may be prohibitively difficult)
If there's a more fuller traceback / etc. I can look at that as well.
from libtmux.
@cidrblock If you try v0.21.0 (which includes #475), is anything different?
from libtmux.
@cidrblock Sounds good. This is a priority since we definitely want libtmux to be xdist compatible
from libtmux.
Hi, I think I am facing the same issue.
To reproduce the problem:
- Attach a tmux session
tmux new -A -s main
- run the following code
repro.py
import libtmux
tmux_server = libtmux.Server()
session = tmux_server.new_session(session_name="repro-bug", kill_session=True)
window = session.windows[0]
window.rename_window("BOOM")
The traceback
Traceback (most recent call last):
File "bug-repro-libtmux.py", line 6, in <module>
window.rename_window("BOOM")
File "/...site-packages/libtmux/window.py", line 480, in rename_window
self.refresh()
File "/...site-packages/libtmux/window.py", line 84, in refresh
return super()._refresh(
^^^^^^^^^^^^^^^^^
File "/...site-packages/libtmux/neo.py", line 175, in _refresh
obj = fetch_obj(
^^^^^^^^^^
File "/...site-packages/libtmux/neo.py", line 244, in fetch_obj
raise ObjectDoesNotExist(
libtmux._internal.query_list.ObjectDoesNotExist: Could not find window_id=@2 for list-windows
Done some digging
❯ export PYTHONBREAKPOINT=ipdb.set_trace
❯ python bug-repro-libtmux.py
Some debugging with comments
ipdb> bt
bug-repro-libtmux.py(6)<module>()
4 session = tmux_server.new_session(session_name="repro-bug", kill_session=True)
5 window = session.windows[0]
----> 6 window.rename_window("BOOM")
.../libtmux/window.py(480)rename_window()
479
--> 480 self.refresh()
481
.../libtmux/window.py(84)refresh()
83 assert isinstance(self.window_id, str)
---> 84 return super().\_refresh(
85 obj_key="window_id",
.../libtmux/neo.py(175)\_refresh()
174 assert isinstance(obj_id, str)
--> 175 obj = fetch_obj(
176 obj_key=obj_key, obj_id=obj_id, list_cmd=list_cmd, server=self.server
> .../libtmux/neo.py(243)fetch_obj()
242 breakpoint()
--> 243 if obj is None:
244 raise ObjectDoesNotExist(
#
# We can see that only the window for the current session is returned
# and not the one we are looking for so ObjectDoesNotExist will raise
#
ipdb> obj_id
'@17'
ipdb> obj_key
'window_id'
ipdb> pp [(x["window_name"], x["window_id"]) for x in obj_formatters_filtered]
[('python3.11', '@16')]
#
# Re-run fetch_obj but we will modify list_extra_args from None to ["-a"]
#
ipdb> jump 234
> .../libtmux/neo.py(234)fetch_obj()
233 ) -> OutputRaw:
--> 234 obj_formatters_filtered = fetch_objs(
235 server=server, list_cmd=list_cmd, list_extra_args=list_extra_args
#
# HACK make libtmux run tmux list-windows -a (list all windows of all sessions)
#
ipdb> list_extra_args = ["-a"]
ipdb> pp [(x["window_name"], x["window_id"]) for x in obj_formatters_filtered]
[('python3.11', '@16')]
ipdb> until 238
> .../libtmux/neo.py(238)fetch_obj()
237
--> 238 obj = None
239 for \_obj in obj_formatters_filtered:
# You can see now that the window from the new session is returned
ipdb> pp [(x["window_name"], x["window_id"]) for x in obj_formatters_filtered]
[('python3.11', '@16'), ('BOOM', '@17')]
ipdb> obj_id
'@17'
ipdb> obj_key
'window_id'
#
# and the script exits gracefully
#
ipdb> c
hope this gives some pointers and thx for the lib :)
from libtmux.
A workaround that seems to work for me is to use .cmd()
to bypass the code.
import libtmux
import os
tmux_server = libtmux.Server()
session = tmux_server.new_session(session_name="repro-bug", kill_session=True)
window = session.windows[0]
window.cmd("rename-window", "BOOM")
from libtmux.
@cidrblock Pinning this, in re: ansible/ansible-navigator#1380
Thank you as well for the additional info @sgherdao
from libtmux.
@tony Any chance we could get a fix on this bug. Being forced to use an ancient version of libtmux is more like a playing with a grenade. I tried latest release and i still not working, so we are stuck with 0.16.1 for now.
Usually I would have tried to make a fix it myself but sadly my tmux knowledge is not up for that.
from libtmux.
@ssbarnea Yes, happy to escalate this.
from libtmux.
@cidrblock @ssbarnea @sgherdao The above issue will be resolved by #523.
TLDR: It was caused by refreshing not passing -a
to list-windows
/ list-panes
.
from libtmux.
@cidrblock @ssbarnea @sgherdao:
- v0.28.0 (PyPI, release)
- ansible-navigator related fixes continuing at ansible/ansible-navigator#1687.
from libtmux.
Related Issues (20)
- Tests failing on ppc64le HOT 2
- Tests failing on aarch64 HOT 2
- Tests failing on armv7l HOT 3
- Intermittent errors with tests on x86_64 / amd64 HOT 7
- Intermittent errors with tests on i586 (32bit)
- Is there any way to connect to a tmux session on a remote machine? HOT 1
- Intermittent / flaky test test_capture_pane
- select_pane not working correctly with multiple sessions HOT 2
- Drop Python 3.7 HOT 1
- `build(build-system)`: Remove `setuptools` build dependency
- unknown pytest option --doctest-docutils-modules HOT 7
- Unable to access server via WSGI HOT 4
- `TmuxObjectDoesNotExist` when creating `libtmux.Server().new_session(attach=True)` HOT 13
- Remove assert from __eq__ for windows HOT 5
- Tests failing with "FileNotFoundError: [Errno 2]" and "Unknown directive type: 'currentmodule' [myst.directive_unknown]" HOT 6
- Tests: Snapshots
- Options: Typed structures
- Environment: Add to `new-window`, `split-window`, `respawn-window`, `respawn-pane`
- No implicit exports from __init__.py HOT 1
- `pane.send_keys()` doesn't send cmd to correct pane when cmd has a `-t` flag HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libtmux.