Skip to content
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

Exiting from an interactive session causes a crash in xonsh #272

Closed
arnfaldur opened this issue Oct 4, 2021 · 2 comments · Fixed by #273
Closed

Exiting from an interactive session causes a crash in xonsh #272

arnfaldur opened this issue Oct 4, 2021 · 2 comments · Fixed by #273

Comments

@arnfaldur
Copy link

When running zi and pressing escape to leave the program, an error occurs.

Exception in thread Thread-29:
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/xonsh/procs/__amalgam__.py", line 2319, in run
    r = self.f(self.args, sp_stdin, sp_stdout, sp_stderr, spec, spec.stack)
  File "/usr/lib/python3.9/site-packages/xonsh/procs/__amalgam__.py", line 2100, in proxy_one
    return f(args)
  File "zoxide", line 123, in __zoxide_zi
/home/<user>/.config/xonsh/rc.xsh.ZoxideSilentException

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/tokenize.py", line 330, in find_cookie
    line_string = line.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 24: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/site-packages/xonsh/procs/__amalgam__.py", line 2337, in run
    xt.print_exception()
  File "/home/<user>/.local/lib/python3.9/site-packages/xontrib/readable-traceback.xsh", line 69, in _print_exception
    backtrace.hook(
  File "/home/<user>/.local/lib/python3.9/site-packages/backtrace.py", line 182, in hook
    backtrace_excepthook(tpe=tpe, value=value, tb=tb)
  File "/home/<user>/.local/lib/python3.9/site-packages/backtrace.py", line 162, in backtrace_excepthook
    traceback_entries = traceback.extract_tb(tb)
  File "/usr/lib/python3.9/traceback.py", line 72, in extract_tb
    return StackSummary.extract(walk_tb(tb), limit=limit)
  File "/usr/lib/python3.9/traceback.py", line 366, in extract
    f.line
  File "/usr/lib/python3.9/traceback.py", line 288, in line
    self._line = linecache.getline(self.filename, self.lineno).strip()
  File "/usr/lib/python3.9/linecache.py", line 30, in getline
    lines = getlines(filename, module_globals)
  File "/usr/lib/python3.9/linecache.py", line 46, in getlines
    return updatecache(filename, module_globals)
  File "/usr/lib/python3.9/linecache.py", line 136, in updatecache
    with tokenize.open(fullname) as fp:
  File "/usr/lib/python3.9/tokenize.py", line 394, in open
    encoding, lines = detect_encoding(buffer.readline)
  File "/usr/lib/python3.9/tokenize.py", line 371, in detect_encoding
    encoding = find_cookie(first)
  File "/usr/lib/python3.9/tokenize.py", line 335, in find_cookie
    raise SyntaxError(msg)
SyntaxError: invalid or missing encoding declaration for '/usr/bin/zoxide'

Xonsh stops responding when this happens but I suspect that is a issue on their end.

@arnfaldur
Copy link
Author

I managed to mitigate the issue by adding this to my rc.xsh

aliases['zi'] = '/usr/bin/zoxide query --interactive'

overriding the usage of the __zoxide_zi function that is causing the issue.

@ajeetdsouza
Copy link
Owner

Fixed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants