New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tmuxp freeze cause IndexError #27

Closed
leechannl opened this Issue Dec 4, 2013 · 6 comments

Comments

Projects
None yet
2 participants
@leechannl

leechannl commented Dec 4, 2013

Hi, I just ran tmuxp freeze test in a tmux window, and got the following traceback:

~/workspace/tmuxp/ [master]tmuxp freeze test
Traceback (most recent call last):
  File "/home/maomao/.virtualenvs/tmuxp/bin/tmuxp", line 9, in <module>
    load_entry_point('tmuxp==0.1.0rc2', 'console_scripts', 'tmuxp')()
  File "/home/maomao/workspace/tmuxp/tmuxp/cli.py", line 958, in main
    command_freeze(args)
  File "/home/maomao/workspace/tmuxp/tmuxp/cli.py", line 336, in command_freeze
    'session_name': ctext
  File "/home/maomao/workspace/tmuxp/tmuxp/util.py", line 159, in findWhere
    return self.where(attrs)[0] or None
IndexError: list index out of range

The tmuxp version I installed is: 0.1.0rc4, and it's in a virtualenv.
I use zsh, and Oh-my-Zsh.
Python version is Python 2.7.5+.
My OS is Ubuntu 13.10.
Besides, I ran the tests, all pass.

@tony

This comment has been minimized.

Member

tony commented Dec 4, 2013

@leechannl Thank you for the report!

Does this happen if the panes only use bash?

What is your PS1 in zsh / what is the oh-my-zsh theme?

What windows were open in the session when the crash happens? Any unicode / fancy symbol text in any of the panes?

Probably isn't be relevant but FYI: The current tmuxp seems to be v0.1.0rc2 according to the .virtualenvs/tmuxp/.

@leechannl

This comment has been minimized.

leechannl commented Dec 4, 2013

@tony

It turns out that I input the wrong parameter. I don't have a test session while I ran tmux freeze test.

After I sourced tmuxp.zsh, the available sessions are obviously shown up. In my case I should run tmuxp freeze 0.

Thanks for the help!

@ghost ghost assigned tony Dec 4, 2013

@tony

This comment has been minimized.

Member

tony commented Dec 4, 2013

@leechannl Thank you. I can confirm that $ tmuxp freeze needs to give a more helpful error if session doesn't exist. I will follow up with a patch.

@leechannl

This comment has been minimized.

leechannl commented Dec 4, 2013

@tony
The freeze help message suggests it supports to freeze several sessions.

(tmuxp) tmuxp (master) ✗ tmuxp freeze -h
usage: tmuxp freeze [-h] [-L socket-name] [-S socket-path] [-y]
                    session_name [session_name ...]

But the result I got is not as expected.

(tmuxp) tmuxp (master) ✗ tmuxp freeze 0 1 3
args is Namespace(answer_yes=None, callback=<function command_freeze at 0x9036b8c>, colors=None, session_name=['0', '1', '3'], socket_name=None, socket_path=None)
session name are ['0', '1', '3']
Traceback (most recent call last):
  File "/home/maomao/.virtualenvs/tmuxp/bin/tmuxp", line 9, in <module>
    load_entry_point('tmuxp==0.1.0rc4', 'console_scripts', 'tmuxp')()
  File "/home/maomao/workspace/tmuxp/tmuxp/cli.py", line 958, in main
    command_freeze(args)
  File "/home/maomao/workspace/tmuxp/tmuxp/cli.py", line 335, in command_freeze
    'session_name': ctext
  File "/home/maomao/workspace/tmuxp/tmuxp/util.py", line 159, in findWhere
    return self.where(attrs)[0] or None
IndexError: list index out of range

I can confirm that the valid session names are 0 1 3 in my case.

(tmuxp) tmuxp (master) ✗ tmux list-sessions 
0: 2 windows (created Tue Dec  3 16:01:57 2013) [213x54] (attached)
1: 1 windows (created Wed Dec  4 10:50:35 2013) [213x54]
3: 1 windows (created Wed Dec  4 20:47:53 2013) [80x23]

tony added a commit that referenced this issue Dec 4, 2013

@tony

This comment has been minimized.

Member

tony commented Dec 4, 2013

@leechannl I committed a fix for this.

FYI at this point, $ tmuxp freeze only accepts 1 session at a time.

Can you try $ tmuxp freeze 0.

For future reference (in case anyone reads this): you can rename current sessions manually via Ctrl-b $ or Ctrl-a $ depending on the prefix key. The english version of the docs has this at http://tmuxp.readthedocs.org/en/latest/about_tmux.html#session-name. This page is not updated yet in 中文 docs.

v0.1.0rc5 is on pypi. Can you give this a try?

@tony

This comment has been minimized.

Member

tony commented Dec 4, 2013

@leechannl I also confirm and additional issue - how CLI presents session names as if it allows multiple. I will make a second issue for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment