Closed StreakyCobra closed 7 years ago
Thanks for putting this in @StreakyCobra! Trouble in the context manager, though...
conda activate Exception in thread Thread-50:
Traceback (most recent call last):
File "/home/gil/miniconda3/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/home/gil/miniconda3/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/gil/miniconda3/lib/python3.5/site-packages/prompt_toolkit/interface.py", line 840, in run
completions = list(buffer.completer.get_completions(document, complete_event))
File "/home/gil/miniconda3/lib/python3.5/site-packages/xonsh/ptk/completer.py", line 49, in get_compls
self.ctx)
File "/home/gil/miniconda3/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 122, in complete
out = func(prefix, line, begidx, endidx, ctx)
File "/home/gil/git/xonda/xontrib/xonda.xsh", line 118, in _xonda_completer
possible = set([env.name for env in _get_envs()])
File "/home/gil/git/xonda/xontrib/xonda.xsh", line 31, in _get_envs
for env_name in _list_dirs(envs_dir):
File "/home/gil/git/xonda/xontrib/xonda.xsh", line 12, in _list_dirs
with os.scandir(path) as it:
AttributeError: __exit__
Uh? I don't have this. It is due to python version (3.5 vs 3.6)?
Ahh, I bet that's a 3.5 v 3.6 thing, yes. How about
for entry in os.scandir(path):
if not entry.name.startswith('.') and entry.is_dir():
yield entry.name
?
That works on my end on 3.5 and we do want to maintain compatibility.
Would be fine for me, I just copy/pasted foolishly the code from the python3.6 os
doc page ^^
Ok -- would you like to put in the change?
Done :D (I'm so fast) :joy:
Kidding, I was already pushing it in :-)
Thanks, @StreakyCobra !
This fix a bug when
ls
is aliased by the user.Signed-off-by: Fabien Dubosson fabien.dubosson@gmail.com