santagada / xontrib-powerline

Powerline for Xonsh shell
MIT License
49 stars 20 forks source link

Powerline fails with 'Unknown environment variable: $0' #20

Open StreakyCobra opened 5 years ago

StreakyCobra commented 5 years ago

Hi,

After upgrading xonsh this morning (version https://github.com/xonsh/xonsh/commit/aca294b86cce5275ce77761c38ac1cf50cefd3e8), powerline is not working any longer. Here is the trackeback of the error:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/xonsh/proc.py", line 1696, in wait
    r = self.f(self.args, stdin, stdout, stderr, spec, spec.stack)
  File "/usr/lib/python3.7/site-packages/xonsh/proc.py", line 1197, in proxy_two
    return f(args, stdin)
  File "/usr/lib/python3.7/site-packages/xonsh/xontribs.py", line 178, in xontribs_main
    return _MAIN_XONTRIB_ACTIONS[ns.action](ns)
  File "/usr/lib/python3.7/site-packages/xonsh/xontribs.py", line 98, in _load
    xontribs_load(ns.names, verbose=ns.verbose)
  File "/usr/lib/python3.7/site-packages/xonsh/xontribs.py", line 90, in xontribs_load
    update_context(name, ctx=ctx)
  File "/usr/lib/python3.7/site-packages/xonsh/xontribs.py", line 69, in update_context
    modctx = xontrib_context(name)
  File "/usr/lib/python3.7/site-packages/xonsh/xontribs.py", line 33, in xontrib_context
    m = importlib.import_module(spec.name)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/fabien/.local/lib/python3.7/site-packages/xontrib/powerline.xsh", line 223, in <module>
    pl_build_prompt()
  File "/home/fabien/.local/lib/python3.7/site-packages/xontrib/powerline.xsh", line 213, in pl_build_prompt
    if varname not in __xonsh_env__:
  File "/usr/lib/python3.7/site-packages/xonsh/built_ins.py", line 1468, in __getitem__
    return self.obj.__getitem__(item)
  File "/usr/lib/python3.7/site-packages/xonsh/environ.py", line 1154, in __getitem__
    raise KeyError(e.format(key))
KeyError: 'Unknown environment variable: $0'

Let me know if you need more information!

t11em commented 5 years ago

It was solved by reflecting this pull request

StreakyCobra commented 5 years ago

@t11em Indeed this seems to fix the issue, thanks for the link! Applied locally, waiting for it to be merged :-)

santagada commented 5 years ago

thanks, I merged the PR, later this week will do another release

gdoenlen commented 5 years ago

@santagada did you get around to releasing this? receiving this on a new install today.

edit: added the error

xontrib\powerline.xsh:213: DeprecationWarning: __xonsh_env__ has been deprecated, please use __xonsh__.env instead.
  if varname not in __xonsh_env__:
xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
KeyError: 'Unknown environment variable: $0'
stharding commented 5 years ago

Just tried a fresh install of xonsh and this. This is still an issue. Is the pull request mentioned by @t11em going to be merged?

stharding commented 5 years ago

Oops, I didn't read carefully enough. I see that this pr is merged. @santagada was that release ever done?