Focus option doesn't work #37

Closed
andrea96 opened this Issue Dec 28, 2013 · 6 comments

Projects

None yet

2 participants

@andrea96

Consider this code(from documentation):

session_name: focus
windows:
  - window_name: attached window
    focus: true
    panes:
    - shell_command:
      - pwd
      - echo 'this pane should be selected on load'
      focus: true
    - shell_command:
      - cd /var/log
      - pwd
  - window_name: second window
    shell_command_before: cd /var/log
    panes:
    - pane
    - shell_command:
      - echo 'this pane should be focused, when window switched to first 
time'
      focus: true
    - pane

If I execute "tmuxp load focus.yaml" (focus.yaml is in /home/user/.tmuxp) it doesn't work.

(I) [19:12:41] tmuxp.cli cli.load_workspace():260 Loading /home/andrea/.tmuxp/focus.yaml.
Traceback (most recent call last):
  File "/usr/bin/tmuxp", line 9, in <module>
    load_entry_point('tmuxp==0.1.1', 'console_scripts', 'tmuxp')()
  File "/usr/lib/python3.3/site-packages/tmuxp-0.1.1-py3.3.egg/tmuxp/cli.py", line 962, in main
    command_load(args)
  File "/usr/lib/python3.3/site-packages/tmuxp-0.1.1-py3.3.egg/tmuxp/cli.py", line 427, in command_load
    load_workspace(file_user, args)
  File "/usr/lib/python3.3/site-packages/tmuxp-0.1.1-py3.3.egg/tmuxp/cli.py", line 263, in load_workspace
    sconfig = sconfig.import_config(config_file).get()
  File "/usr/lib/python3.3/site-packages/kaptan/__init__.py", line 69, in import_config
    self.configuration_data = self.handler.load(value)
  File "/usr/lib/python3.3/site-packages/kaptan/handlers/yaml_handler.py", line 20, in load
    return yaml.load(data)
  File "/usr/lib/python3.3/site-packages/yaml/__init__.py", line 72, in load
    return loader.get_single_data()
  File "/usr/lib/python3.3/site-packages/yaml/constructor.py", line 35, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 111, in compose_sequence_node
    node.value.append(self.compose_node(node, index))
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 111, in compose_sequence_node
    node.value.append(self.compose_node(node, index))
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/usr/lib/python3.3/site-packages/yaml/composer.py", line 110, in compose_sequence_node
    while not self.check_event(SequenceEndEvent):
  File "/usr/lib/python3.3/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python3.3/site-packages/yaml/parser.py", line 403, in parse_indentless_sequence_entry
    if self.check_token(BlockEntryToken):
  File "/usr/lib/python3.3/site-packages/yaml/scanner.py", line 115, in check_token
    while self.need_more_tokens():
  File "/usr/lib/python3.3/site-packages/yaml/scanner.py", line 149, in need_more_tokens
    self.stale_possible_simple_keys()
  File "/usr/lib/python3.3/site-packages/yaml/scanner.py", line 289, in stale_possible_simple_keys
    "could not found expected ':'", self.get_mark())
yaml.scanner.ScannerError: while scanning a simple key
  in "<unicode string>", line 19, column 1:
    time'
    ^
could not found expected ':'
  in "<unicode string>", line 20, column 12:
          focus: true
               ^

I tried both Python 3 and Python 2. I also tried to install via pip or source(lastest version on github).
Sorry for my basic english.

PS: I'm on ArchLinux

@andrea96

Running "./run-tests.py -F" (lastest version from github)

test_pane_order (tmuxp.testsuite.test_workspacebuilder.PaneOrderingTest) ... FAIL

======================================================================
FAIL: test_pane_order (tmuxp.testsuite.test_workspacebuilder.PaneOrderingTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/andrea/tmuxp/tmuxp/testsuite/test_workspacebuilder.py", line 492, in test_pane_order
    self.assertEqual(p.get('pane_current_path'), pane_path)
AssertionError: '/usr/bin' != '/sbin'
- /usr/bin
?  - --
+ /sbin


----------------------------------------------------------------------
Ran 37 tests in 16.487s

FAILED (failures=1)
@tony
Owner

Hi, thank you for your report.

I want to make sure this isn't a pyyaml issue.

Can you try changing:

    panes:
    - pane
    - shell_command:
      - echo 'this pane should be focused, when window switched to first 
time'
      focus: true
    - pane

to

    panes:
    - pane
    - shell_command:
      - echo 'this pane should be focused, when window switched to first time'
      focus: true
    - pane

If that isn't the issue, can you give me the result of

tmuxp -v

tmux -V

which tmux

which python

python -V

and any other information that would be helpful?

@andrea96

Wait, I'm an idiot. Now I simply pasted my focus.yaml from github to nano, then I saved and it works.
I think that my vim tabulation breaks yaml file, your program works very well and I like it a lot.
There is only a little particular I noticed, if I launch the python 3 version of tmuxp without any arguments it crashes, instead in python 2 version it shows an usage message.

@tony
Owner

@andrea96 Glad to see you got this working on python 2.

For python 3, can you show me the error message you receive?

How are you launching tmuxp in python 3? From a virtualenv set to python 3?

Can you give me the -V of your python 3? And the tmuxp -V?

@andrea96

Ok, now I am on ArchLinux, so Python 3 is default Python and I have simply installed tmuxp with:
pip install tmuxp
I don't using virtualenv and I normally launch tmuxp with tmuxp
But I receive this error:

Traceback (most recent call last):
  File "/usr/bin/tmuxp", line 9, in <module>
    load_entry_point('tmuxp==0.1.1', 'console_scripts', 'tmuxp')()
  File "/usr/lib/python3.3/site-packages/tmuxp/cli.py", line 961, in main
    if args.callback is command_load:
AttributeError: 'Namespace' object has no attribute 'callback'

python -V
Python 3.3.3
tmuxp -V

usage: tmuxp [-h] [-L socket-name] [-S socket-path] [-y] [-v]
             {kill-session,attach-session,freeze,load,convert,import} ...
tmuxp: error: unrecognized arguments: -V

Did you mean tmuxp -v?

tmuxp 0.1.1

However it works with any argument, it say me an error only if I don't pass any argument.

@tony
Owner

@andrea96: Thanks again for the report. I have not been able to replicate this issue on my end, if this issue comes up again, please reopen this.

@tony tony closed this Mar 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment