tmux-python/tmuxp

Unable to load the very first session

animeshkrishnabulusu opened this issue · 0 comments

Step 1: Provide a summary of your problem

I am trying to load an example session from the documentation, (copied not typed). tmuxp is unable to load the session. I get the error: ObjectDoesNotExist: Could not find session_id=$0 for list-sessions

Step 2: Provide tmuxp details

~$ tmuxp debug-info

-------------------------
environment:
	dist: Linux-6.1.0-23-amd64-x86_64-with-glibc2.36
	arch: x86_64
	uname: Linux; anmsh1; 6.1.0-23-amd64
	version: #1 SMP PREEMPT_DYNAMIC Debian 6.1.99-1 (2024-07-15)
-------------------------
python version: 3.11.2 (main, May  2 2024, 11:59:08) [GCC 12.2.0]
tmux version: 3.3
libtmux version: 0.21.0
tmuxp version: 1.27.0
tmux path: /usr/bin/tmux
tmuxp path: /usr/lib/python3/dist-packages/tmuxp
shell: /bin/bash
-------------------------
tmux sessions:
	4-pane-split: 1 windows (created Sun Aug 18 15:45:55 2024)



tmux windows:
	0: bash* (1 panes) [800x600] [layout 87dd,800x600,0,0,0] @0 (active)



tmux panes:
	0: [800x600] [history 0/2000, 20200 bytes] %0 (active)



tmux global options:
	activity-action other
	assume-paste-time 1
	base-index 0
	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 2000
	key-table root
	lock-after-time 0
	lock-command "lock -np"
	message-command-style bg=black,fg=yellow
	message-style bg=yellow,fg=black
	mouse off
	prefix C-b
	prefix2 None
	renumber-windows off
	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 emacs
	status-left "[#{session_name}] "
	status-left-length 10
	status-left-style default
	status-position bottom
	status-right "#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,}\"#{=21:pane_title}\" %H:%M %d-%b-%y"
	status-right-length 40
	status-right-style default
	status-style bg=green,fg=black
	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
	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 emacs
	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 0
	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_flags,#{window_flags}, }"
	window-status-current-style default
	window-status-format "#I:#W#{?window_flags,#{window_flags}, }"
	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. Copy session.yaml from quickstart
  2. Run tmuxp load .tmuxp/session.yaml

Observed Results:

Error on trying to load the very first session:

~$ tmuxp load .tmuxp/session.yaml
[Loading] /home/anmsh/.tmuxp/session.yaml
Traceback (most recent call last):
  File "/usr/bin/tmuxp", line 33, in <module>
    sys.exit(load_entry_point('tmuxp==1.27.0', 'console_scripts', 'tmuxp')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/tmuxp/cli/__init__.py", line 134, in cli
    command_load(
  File "/usr/lib/python3/dist-packages/tmuxp/cli/load.py", line 642, in command_load
    load_workspace(
  File "/usr/lib/python3/dist-packages/tmuxp/cli/load.py", line 454, in load_workspace
    _load_attached(builder, detached)
  File "/usr/lib/python3/dist-packages/tmuxp/cli/load.py", line 184, in _load_attached
    builder.build()
  File "/usr/lib/python3/dist-packages/tmuxp/workspace/builder.py", line 242, in build
    session = self.server.new_session(
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/libtmux/server.py", line 494, in new_session
    return Session.from_session_id(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/libtmux/session.py", line 85, in from_session_id
    session = fetch_obj(
              ^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/libtmux/neo.py", line 244, in fetch_obj
    raise ObjectDoesNotExist(
libtmux._internal.query_list.ObjectDoesNotExist: Could not find session_id=$0 for list-sessions

If I load it again I get this:

. . . 
 . . . 
  . . . 
libtmux.exc.TmuxSessionExists: Session named 4-pane-split exists

Expected Results:

Load session as per the session.yaml file.

Relevant Code:

session.yaml from documentation.

session_name: 4-pane-split
windows:
  - window_name: dev window
    layout: tiled
    shell_command_before:
      - cd ~/ # run as a first command in all panes
    panes:
      - shell_command: # pane no. 1
          - cd /var/log # run multiple commands in this pane
          - ls -al | grep \.log
      - echo second pane # pane no. 2
      - echo third pane # pane no. 3
      - echo forth pane # pane no. 4