tmux-python / tmux-python/tmuxp
colors is compared as an int but set as a string
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 248
- Avg merge
- 2h 13m
- Merged PRs (30d)
- 1
Description
I am running tmuxp 1.7.2 on Arch Linux. When I attempt to load a workspace, I see the following output:
% tmuxp load desktop
[Loading] /home/sam/dotfiles/shell/.config/tmuxp/desktop.yaml
Traceback (most recent call last):
File "/usr/bin/tmuxp", line 33, in <module>
sys.exit(load_entry_point('tmuxp==1.7.2', 'console_scripts', 'tmuxp')())
File "/usr/lib/python3.9/site-packages/click/core.py", line 1134, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/click/core.py", line 1059, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.9/site-packages/click/core.py", line 1665, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.9/site-packages/click/core.py", line 1401, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.9/site-packages/click/core.py", line 767, in invoke
return __callback(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/lib/python3.9/site-packages/tmuxp/cli.py", line 1096, in command_load
load_workspace(config[-1], **tmux_options)
File "/usr/lib/python3.9/site-packages/tmuxp/cli.py", line 684, in load_workspace
if builder.session_exists(session_name) and not append:
File "/usr/lib/python3.9/site-packages/tmuxp/workspacebuilder.py", line 107, in session_exists
exists = self.server.has_session(session_name)
File "/usr/lib/python3.9/site-packages/libtmux/server.py", line 372, in has_session
proc = self.cmd('has-session', '-t%s' % target_session)
File "/usr/lib/python3.9/site-packages/libtmux/server.py", line 127, in cmd
raise ValueError('Server.colors must equal 88 or 256')
ValueError: Server.colors must equal 88 or 256
Inspecting the variables using pdb (python -m pdb /usr/bin/tmuxp load desktop) reveals that self.colors is set to the string '256' (or '88' if the -8 flag is passed) but libtmux is comparing the value against an integer literal (256 or 88).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in tmuxp/cli.py at command_load and load_workspace, then trace how tmux_options reaches libtmux/server.py's cmd method. Confirm where the colors value becomes a string and add a regression test covering both default and -8 color settings; done means loading a workspace no longer raises the integer-comparison error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100