prompt-toolkit / prompt-toolkit/python-prompt-toolkit

termios.error: (5, 'Input/output error') on xonsh appimage with prompt_toolkit 3

Open
#1,123 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

Hello!

When I try to run xonsh.AppImage from bash I get the error termios.error: (5, 'Input/output error'). Could you please help to understand the cause?

5 minute way to create xonsh.AppImage and reproduce on linux:

mkdir -p /tmp/test && cd /tmp/test
git clone https://github.com/niess/python-appimage && cd python-appimage
echo -e "git+https://github.com/xonsh/xonsh\nprompt_toolkit\nPygments" > applications/xonsh/requirements.txt 
python -m python_appimage build app applications/xonsh

After it run from bash:

./xonsh-x86_64.AppImage --shell-type ptk3
@ echo 123

As result:

Stopped xonsh-x86_64.AppImage

 File "/tmp/.mount_xonsh-cjX0IA/opt/python3.8/lib/python3.8/site-packages/xonsh/main.py", line 405, in main
    return main_xonsh(args)
  File "/tmp/.mount_xonsh-cjX0IA/opt/python3.8/lib/python3.8/site-packages/xonsh/main.py", line 434, in main_xonsh
    shell.shell.cmdloop()
  File "/tmp/.mount_xonsh-cjX0IA/opt/python3.8/lib/python3.8/site-packages/xonsh/ptk_shell/shell.py", line 197, in cmdloop
    line = self.singleline(auto_suggest=auto_suggest)
  File "/tmp/.mount_xonsh-cjX0IA/opt/python3.8/lib/python3.8/site-packages/xonsh/ptk_shell/shell.py", line 166, in singleline
    line = self.prompter.prompt(**prompt_args)
  File "/tmp/.mount_xonsh-cjX0IA/opt/python3.8/lib/python3.8/site-packages/prompt_toolkit/shortcuts/prompt.py", line 994, in prompt
    return self.app.run(set_exception_handler=set_exception_handler)
  File "/tmp/.mount_xonsh-cjX0IA/opt/python3.8/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 811, in run
    return loop.run_until_complete(
  File "/tmp/.mount_xonsh-cjX0IA/opt/python3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/tmp/.mount_xonsh-cjX0IA/opt/python3.8/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 778, in run_async
    return await _run_async2()
  File "/tmp/.mount_xonsh-cjX0IA/opt/python3.8/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 760, in _run_async2
    result = await _run_async()
  File "/tmp/.mount_xonsh-cjX0IA/opt/python3.8/lib/python3.8/site-packages/prompt_toolkit/application/application.py", line 682, in _run_async
    with self.input.raw_mode():
  File "/tmp/.mount_xonsh-cjX0IA/opt/python3.8/lib/python3.8/site-packages/prompt_toolkit/input/vt100.py", line 259, in __enter__
    termios.tcsetattr(self.fileno, termios.TCSANOW, newattr)
termios.error: (5, 'Input/output error')
Xonsh encountered an issue during launch
Failback to /bin/sh

Could you please help or give an advice how I can debug this and find the cause?

I noticed that this error appears when I run xonsh.AppImage from bash. If I install xonsh locally, run it and then run xonsh.AppImage from xonsh it works without errors.

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the AppImage launch from bash using the commands in the issue, then compare it with launching the AppImage from a local xonsh session. Trace the failure through xonsh/ptk_shell/shell.py and prompt_toolkit/input/vt100.py, especially the termios.tcsetattr call. Done means identifying why the terminal mode change fails and documenting a confirmed fix or workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, linux, python
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.