wouterdebie / i2cssh

csshX like ssh tool for iTerm2
MIT License
547 stars 68 forks source link

UnboundLocalError: cannot access local variable 'global_opts' where it is not associated with a value #130

Closed bruiiser closed 1 year ago

bruiiser commented 1 year ago

Describe the bug Unless there is a '~/.i2csshrc' file i2cssh fails with the error message in the title of this report

My config

  1. I don't normally have a .i2csshrc file. but adding one that is basically empty addresses the error. I put this content into a config file and got the script to work again:
---
version: 2
  1. any and all commands fail in the absence of a config file

Expected behavior Well of course i would expect this NOT to throw the error

Screenshots or stack traces Here is the entire stack trace:

Traceback (most recent call last):
  File "/opt/homebrew/bin/i2cssh", line 33, in <module>
    sys.exit(load_entry_point('i2cssh==0.1.6', 'console_scripts', 'i2cssh')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/i2cssh/0.1.6/libexec/lib/python3.11/site-packages/i2cssh/main.py", line 6, in main
    app(prog_name="i2cssh")
  File "/opt/homebrew/Cellar/i2cssh/0.1.6/libexec/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/i2cssh/0.1.6/libexec/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/i2cssh/0.1.6/libexec/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/i2cssh/0.1.6/libexec/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/i2cssh/0.1.6/libexec/lib/python3.11/site-packages/i2cssh/lib.py", line 263, in app
    or global_opts.get("tab_split")
       ^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'global_opts' where it is not associated with a value

Additional context Add any other context about the problem here.

wouterdebie commented 1 year ago

This should be fixed in 0.1.9.