tmuxp: ValueError: Server.colors must equal 88 or 256
Step 1: Provide a summary of your problem
- Example command breaking on fresh install, running
tmuxp load mysessionwith the4-pane-splitconfiguration is returning the following error:
Traceback (most recent call last):
File "/Users/trajano/Library/Python/3.9/bin/tmuxp", line 8, in <module>
sys.exit(cli.cli())
File "/Users/trajano/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1025, in __call__
return self.main(*args, **kwargs)
File "/Users/trajano/Library/Python/3.9/lib/python/site-packages/click/core.py", line 955, in main
rv = self.invoke(ctx)
File "/Users/trajano/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1517, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/trajano/Library/Python/3.9/lib/python/site-packages/click/core.py", line 1279, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/trajano/Library/Python/3.9/lib/python/site-packages/click/core.py", line 710, in invoke
return callback(*args, **kwargs)
File "/Users/trajano/Library/Python/3.9/lib/python/site-packages/click/decorators.py", line 18, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/trajano/Library/Python/3.9/lib/python/site-packages/tmuxp/cli.py", line 959, in command_load
load_workspace(config[-1], **tmux_options)
File "/Users/trajano/Library/Python/3.9/lib/python/site-packages/tmuxp/cli.py", line 555, in load_workspace
if builder.session_exists(session_name):
File "/Users/trajano/Library/Python/3.9/lib/python/site-packages/tmuxp/workspacebuilder.py", line 102, in session_exists
exists = self.server.has_session(session_name)
File "/Users/trajano/Library/Python/3.9/lib/python/site-packages/libtmux/server.py", line 373, in has_session
proc = self.cmd('has-session', '-t%s' % target_session)
File "/Users/trajano/Library/Python/3.9/lib/python/site-packages/libtmux/server.py", line 128, in cmd
raise ValueError('Server.colors must equal 88 or 256')
ValueError: Server.colors must equal 88 or 256
It looks like args.colors is set to a type of string which does not match the given color options. Looked into it and it seems like it’s due to tmuxp pulling the pre-release version of click (8.0.0a1). I manually cloned the 7.1.2 to my site-packages and it’s working again.
Need to either cast type (to be safe) and/or fix click constraint. I’m not super familiar with python but let me know if you would like me to get a pr out for this. Thanks!
Step 2: Provide tmuxp details
-------------------------
environment:
dist: macOS-10.15.4-x86_64-i386-64bit
arch: x86_64
uname: Darwin; Mauricios-MacBook-Pro.local; 19.4.0
version: Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64
-------------------------
python version: 3.9.0 (default, Nov 21 2020, 14:01:50) [Clang 12.0.0 (clang-1200.0.32.27)]
system PATH: /Users/trajano/.nvm/versions/node/v12.18.2/bin:/Users/trajano/bin:/usr/local/bin:Library/Python/3.9/bin:/Users/trajano/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/trajano/.composer/vendor/bin:/Users/trajano/.cargo/bin
tmux version: 3.1
libtmux version: 0.8.5
tmuxp version: 1.6.3
tmux path: /usr/local/bin/tmux
tmuxp path: /Users/trajano/Library/Python/3.9/lib/python/site-packages/tmuxp/__init__.py
shell: /bin/zsh
-------------------------
Step 3: Describe the problem:
Steps to reproduce:
- Fresh install on macOS X
- Copy sample
4-pane-splitconfig and try to load sample session
Observed Results:
- Crashed with
ValueError: Server.colors must equal 88 or 256
Expected Results:
- Loads session with the correct config
Relevant Code:
N/A
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 5
- Comments: 17 (4 by maintainers)
Commits related to this issue
- Adding commas to requirements/base.txt It was installing click 8.0.0.1a Addresses #649 — committed to dougharris/tmuxp by dougharris 4 years ago
- Adding commas to requirements/base.txt (#651) It was installing click 8.0.0.1a Addresses #649 — committed to tmux-python/tmuxp by dougharris 3 years ago
- Adding commas to requirements/base.txt (#651) It was installing click 8.0.0.1a Addresses #649 — committed to tmux-python/tmuxp by dougharris 3 years ago
- Fix #649 It appears click 8 decided to change `flag_value`s to strings - somewhat reasonably. This commit is backward compatible with click 7, so I'll leave the dependency alone til a more through ev... — committed to Iiridayn/tmuxp by Iiridayn 3 years ago
- click: Relax requirement to allow 8.0 See also: #649 — committed to tmux-python/tmuxp by tony 3 years ago
- click: Relax requirement to allow 8.0 (#686) Related: #649, #679, #680 — committed to tmux-python/tmuxp by tony 3 years ago
Same for me as @amontalenti. I also installed
tmuxpusingpipxand the tmuxp venv didn’t include pip, so I installed click withHi, I am running into the same issue:
Looks like changing line 1074 of
cli.py(incommand_load) from'colors': colors,to'colors': int(colors),fixes the issue for me. While it is frustrating that they decided to silently change default flag values to strings (presumably a side effect of part of their enhanced flag handling in https://github.com/pallets/click/pull/1618, though I don’t see anything there that would change it), it is not itself unreasonable to have everything coming from the option parser be a string; so, while such a trivial change is moderately hacky, it is perhaps not unreasonably so. It would appear all otherflag_values are strings already - so this would appear to be the only required change. (I also tested if I could set a flag value, but it was appropriately not recognized).Can confirm same issue with 1.6.3. Can confirm that you can fix it by replacing the
clickdependency. Since I usepipxfor managing mytmuxpinstall, I did the following workaround:Which patches it in the venv used for pipx.
Hi, im running into the very same issue