tmux-python / tmux-python/tmuxp

TypeError: expected str, bytes or os.PathLike object, not NoneType when using window_name

Open Beginner friendly
#939 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.6k
Forks
248
Avg merge
2h 13m
Merged PRs (30d)
1

Description

Are you using the latest version of tmuxp? Check tmuxp -V against
https://pypi.org/project/tmuxp/. If it's not the latest, consider updating, e.g.
pip install --user tmuxp.

Step 1: Provide a summary of your problem

We should be able to create windows without specifying the name.

Step 2: Provide tmuxp details
$ tmuxp debug-info
-------------------------
environment:
	dist: Linux-6.9.7-amd64-x86_64-with-glibc2.38
	arch: x86_64
	uname: Linux; debian; 6.9.7-amd64
	version: #1 SMP PREEMPT_DYNAMIC Debian 6.9.7-1 (2024-06-27)
-------------------------
python version: 3.12.4 (main, Jun 12 2024, 19:06:53) [GCC 13.2.0]
system PATH: /home/debian/.cargo/bin:/home/debian/.npm-packages/bin:/home/debian/.local/share/gem/ruby/3.1.0/bin:/home/debian/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
tmux version: 3.4
libtmux version: 0.37.0
tmuxp version: 1.47.0
tmux path: /usr/bin/tmux
tmuxp path: /usr/lib/python3/dist-packages/tmuxp
shell: /bin/bash
-------------------------
tmux sessions:
	Default: 5 windows (created Sat Jun 29 15:15:18 2024) (attached)



tmux windows:
	1: irc (1 panes) [110x32] [layout b0bd,110x32,0,0,0] @0
	2: xmpp (1 panes) [110x32] [layout b0be,110x32,0,0,1] @1
	3: rss- (1 panes) [110x32] [layout b0bf,110x32,0,0,2] @2
	4: downloads (1 panes) [110x32] [layout b0c0,110x32,0,0,3] @3
	5: sudo* (1 panes) [110x32] [layout b0c1,110x32,0,0,4] @4 (active)



tmux panes:
	1: [110x32] [history 0/10000, 4430 bytes] %4 (active)



tmux global options:
	activity-action other
	assume-paste-time 1
	base-index 1
	bell-action any
	default-command ''
	default-shell /bin/bash
	default-size 80x24
	destroy-unattached off
	detach-on-destroy on
	display-panes-active-colour red
	display-panes-colour blue
	display-panes-time 1000
	display-time 750
	history-limit 10000
	key-table root
	lock-after-time 0
	lock-command "lock -np"
	message-command-style bg=black,fg=yellow
	message-line 0
	message-style bg=blue,fg=white
	mouse on
	prefix C-a
	prefix2 None
	renumber-windows on
	repeat-time 500
	set-titles off
	set-titles-string "#S:#I:#W - \"#T\" #{session_alerts}"
	silence-action other
	status on
	status-bg default
	status-fg default
	status-format[0] "#[align=left range=left #{E:status-left-style}]#[push-default]#{T;=/#{status-left-length}:status-left}#[pop-default]#[norange default]#[list=on align=#{status-justify}]#[list=left-marker]<#[list=right-marker]>#[list=on]#{W:#[range=window|#{window_index} #{E:window-status-style}#{?#{&&:#{window_last_flag},#{!=:#{E:window-status-last-style},default}}, #{E:window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{E:window-status-bell-style},default}}, #{E:window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{E:window-status-activity-style},default}}, #{E:window-status-activity-style},}}]#[push-default]#{T:window-status-format}#[pop-default]#[norange default]#{?window_end_flag,,#{window-status-separator}},#[range=window|#{window_index} list=focus #{?#{!=:#{E:window-status-current-style},default},#{E:window-status-current-style},#{E:window-status-style}}#{?#{&&:#{window_last_flag},#{!=:#{E:window-status-last-style},default}}, #{E:window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{E:window-status-bell-style},default}}, #{E:window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{E:window-status-activity-style},default}}, #{E:window-status-activity-style},}}]#[push-default]#{T:window-status-current-format}#[pop-default]#[norange list=on default]#{?window_end_flag,,#{window-status-separator}}}#[nolist align=right range=right #{E:status-right-style}]#[push-default]#{T;=/#{status-right-length}:status-right}#[pop-default]#[norange default]"
	status-format[1] "#[align=centre]#{P:#{?pane_active,#[reverse],}#{pane_index}[#{pane_width}x#{pane_height}]#[default] }"
	status-interval 15
	status-justify left
	status-keys vi
	status-left "#[fg=brightred][ #[fg=brightblue]#S #[fg=brightred]| "
	status-left-length 13
	status-left-style default
	status-position bottom
	status-right "#[fg=brightred]]"
	status-right-length 40
	status-right-style default
	status-style bg=default,fg=white
	update-environment[0] DISPLAY
	update-environment[1] KRB5CCNAME
	update-environment[2] SSH_ASKPASS
	update-environment[3] SSH_AUTH_SOCK
	update-environment[4] SSH_AGENT_PID
	update-environment[5] SSH_CONNECTION
	update-environment[6] WINDOWID
	update-environment[7] XAUTHORITY
	visual-activity off
	visual-bell off
	visual-silence off
	word-separators "!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~"



tmux window options:
	cursor-colour none
	cursor-style default
	menu-style default
	menu-selected-style bg=yellow,fg=black
	menu-border-style default
	menu-border-lines single
	aggressive-resize off
	allow-passthrough off
	allow-rename off
	alternate-screen on
	automatic-rename on
	automatic-rename-format "#{?pane_in_mode,[tmux],#{pane_current_command}}#{?pane_dead,[dead],}"
	clock-mode-colour blue
	clock-mode-style 24
	copy-mode-match-style bg=cyan,fg=black
	copy-mode-current-match-style bg=magenta,fg=black
	copy-mode-mark-style bg=red,fg=black
	fill-character ''
	main-pane-height 24
	main-pane-width 80
	mode-keys vi
	mode-style bg=yellow,fg=black
	monitor-activity off
	monitor-bell on
	monitor-silence 0
	other-pane-height 0
	other-pane-width 0
	pane-active-border-style "#{?pane_in_mode,fg=yellow,#{?synchronize-panes,fg=red,fg=green}}"
	pane-base-index 1
	pane-border-format "#{?pane_active,#[reverse],}#{pane_index}#[default] \"#{pane_title}\""
	pane-border-indicators colour
	pane-border-lines single
	pane-border-status off
	pane-border-style default
	pane-colours
	popup-style default
	popup-border-style default
	popup-border-lines single
	remain-on-exit off
	remain-on-exit-format "Pane is dead (#{?#{!=:#{pane_dead_status},},status #{pane_dead_status},}#{?#{!=:#{pane_dead_signal},},signal #{pane_dead_signal},}, #{t:pane_dead_time})"
	scroll-on-clear on
	synchronize-panes off
	window-active-style default
	window-size latest
	window-style default
	window-status-activity-style reverse
	window-status-bell-style reverse
	window-status-current-format " #I #W "
	window-status-current-style bg=magenta,fg=brightwhite
	window-status-format " #I #W "
	window-status-last-style default
	window-status-separator " "
	window-status-style default
	wrap-search on
	xterm-keys on



Step 3: Describe the problem:
Steps to reproduce:
  1. tmux load test.yaml
Observed Results:
$ tmuxp load test.yml 
[Loading] /home/debian/test.yml
Traceback (most recent call last):
  File "/usr/bin/tmuxp", line 8, in <module>
    sys.exit(cli.cli())
             ^^^^^^^^^
  File "/usr/lib/python3/dist-packages/tmuxp/cli/__init__.py", line 146, in cli
    command_load(
  File "/usr/lib/python3/dist-packages/tmuxp/cli/load.py", line 576, in command_load
    load_workspace(
  File "/usr/lib/python3/dist-packages/tmuxp/cli/load.py", line 308, in load_workspace
    expanded_workspace = loader.expand(
                         ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/tmuxp/workspace/loader.py", line 174, in expand
    expand(window, parent=workspace_dict)
  File "/usr/lib/python3/dist-packages/tmuxp/workspace/loader.py", line 109, in expand
    workspace_dict["window_name"] = expandshell(workspace_dict["window_name"])
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/tmuxp/workspace/loader.py", line 26, in expandshell
    return os.path.expandvars(os.path.expanduser(value))  # NOQA: PTH111
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 259, in expanduser
TypeError: expected str, bytes or os.PathLike object, not NoneType
Expected Results:

Session started called test with a single unnamed window.

Relevant Code:
session_name: test
windows:
  - window_name:
    panes:
      -

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.

Research direction

Start with tmuxp/workspace/loader.py, especially the expansion path shown in the traceback, and reproduce the failure with the minimal YAML under Relevant Code. Verify the load command creates the requested session with one unnamed window when window_name is empty, and add or update regression coverage if the project’s tests expose this loader behavior.

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
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.