Comments (10)
Thanks @anki-code -- merged and released 0.15.0. Going to leave this issue open until we sort out the upstream issue or figure out what part of xonsh is tripping up prompt toolkit
from xonsh.
I can reproduce this on Mac in case of alias with group of commands:
pip install 'xonsh[full]'
xonsh --no-rc
aliases['ttt'] = 'echo 1 && echo 2'
ttt
# 1
# 2
# <Press enter>
# <Press enter>
# Exception:
Traceback (most recent call last):
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 73, in close
loop.run_until_complete(loop.shutdown_default_executor())
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
self.run_forever()
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
self._run_once()
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 1884, in _run_once
event_list = self._selector.select(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/selectors.py", line 566, in select
kev_list = self._selector.control(None, max_ev, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/xonsh/main.py", line 469, in main
sys.exit(main_xonsh(args))
^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/xonsh/main.py", line 513, in main_xonsh
shell.shell.cmdloop()
File "/opt/homebrew/lib/python3.11/site-packages/xonsh/ptk_shell/shell.py", line 405, in cmdloop
line = self.singleline(auto_suggest=auto_suggest)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/xonsh/ptk_shell/shell.py", line 373, in singleline
line = self.prompter.prompt(**prompt_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1026, in prompt
return self.app.run(
^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/prompt_toolkit/application/application.py", line 1002, in run
return asyncio.run(coro)
^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 189, in run
with Runner(debug=debug) as runner:
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 63, in __exit__
self.close()
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 77, in close
loop.close()
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/unix_events.py", line 68, in close
super().close()
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/selector_events.py", line 91, in close
self._close_self_pipe()
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/selector_events.py", line 99, in _close_self_pipe
self._ssock.close()
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 503, in close
self._real_close()
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 497, in _real_close
_ss.close(self)
OSError: [Errno 9] Bad file descriptor
Xonsh encountered an issue during launch
Failback to /bin/zsh
from xonsh.
Just to add link to #4224
from xonsh.
I found that issue appeared starting from prompt-toolkit 3.0.41 where asyncio
was introduced (prompt-toolkit/python-prompt-toolkit@8c60193).
To fix this just downgrade the prompt-toolkit version:
xpip uninstall -y prompt-toolkit
xpip install prompt-toolkit==3.0.40
The issue was reported to upstream - prompt-toolkit/python-prompt-toolkit#1853
from xonsh.
@gforsyth hey! Please see my comment above. It looks like this issue is pretty critical because creates unstable behavior e.g. I see this report in news.ycombinator.com. May be we need to pin prompt-toolkit to <=3.0.40
until the issue with asyncio
will be fixed. What do you think?
from xonsh.
I believe this is the only way for now, though popular packages such as IPython do require newer prompt-toolkit
. I guess the better choice is to add this requirement for the meantime and encourage people to install xonsh
with pipx
.
from xonsh.
I'll be at a computer later and can take a look. In the mean time, if someone can PR the upper pin and add a note to the docs that'll make it faster to release.
from xonsh.
from xonsh.
@gforsyth @anki-code this bug persists even after this fix - but much less
now usually the "Bad File Descriptor" exception doesn't mess with the whole shell
from xonsh.
I confirm this. The simple cases like alias for echo 1 && echo 2
are working on downgraded ptk but the error appears sometimes but without crashing the entire shell.
I'm also facing with this during typing the command:
File "/opt/homebrew/lib/python3.11/site-packages/xonsh/main.py", line 470, in main
sys.exit(main_xonsh(args))
^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/xonsh/main.py", line 514, in main_xonsh
shell.shell.cmdloop()
File "/opt/homebrew/lib/python3.11/site-packages/xonsh/ptk_shell/shell.py", line 406, in cmdloop
line = self.singleline(auto_suggest=auto_suggest)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/xonsh/ptk_shell/shell.py", line 374, in singleline
line = self.prompter.prompt(**prompt_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1024, in prompt
return self.app.run(
^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/prompt_toolkit/application/application.py", line 973, in run
return loop.run_until_complete(coro)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
self.run_forever()
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
self._run_once()
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 1884, in _run_once
event_list = self._selector.select(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/selectors.py", line 566, in select
kev_list = self._selector.control(None, max_ev, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 9] Bad file descriptor
from xonsh.
Related Issues (20)
- FAILED tests/completers/test_bash_completer.py::test_equal_sign_arg[command_context1-completions1-4-False] HOT 2
- Is it possible to use fzf for TAB completions? HOT 5
- Renewal of Xon.sh domain (before Feb 9th), and transfer to another provider ? HOT 2
- Bring consistency to `which` HOT 14
- Show alias function description using superhelp
- Unhelpful "Operation timed out" when failing to load history
- Piping seems broken in windows HOT 3
- Cache xonshrc and imports HOT 3
- Update website - doc still 0.14.0 HOT 2
- Module cgi is deprecated and will be removed in Python 3.13 HOT 1
- On windows, tab-completion works unreliable
- "ValueError: I/O operation on closed file." when using print() with file argument HOT 1
- Tab-completion fails when looking for some special strings in aliases ("less", "more" and "dir") HOT 1
- Add `history dir [path]` to show the history for the current directory HOT 1
- Importing logic is different from python HOT 1
- paste performance issues on windows HOT 4
- `xonfig web` overwrites its own config within the same session (colors vs. prompts) HOT 1
- NotADirectoryError: [Errno 20] Not a directory: 'dircolors'
- `$UPDATE_PROMPT_ON_KEYPRESS = True` is not working HOT 5
- Case with endless loop with no way to interrupt HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xonsh.