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

Problems and Unhandled Exceptions in some unix terminals (those which use libvte).

Open
#1,160 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I'm running a simple prompt-toolkit snippet example, taken from your website.
I have just added few lines to add a console "command" to show you which the problem is.

The snippet can be found in: https://gist.github.com/rendarz/92f57af0ca746c6400299ba7cfd07ed1

Now, the problem is as follows:
When I use with patch_stdout(): as your help DOCS suggest, I encounter the problem, while, when I remove that line, the problem disappear.

The problem seems to happen only on those terminals which uses libvte, such as xfce4-terminal or gnome-terminal, and it seems to NOT happen in those terminals which DO NOT uses libvte, such as Eterm, or xterm. Despite the presence of with patch_stdout(): statement.

While using the console, I have inserted a simple command, as you can see from the example above ^ which makes the program to do a loop, and print 100 numbers, from 0 to 99.
When I fire that command, printing slows down at 31, then it suddenly run again until 65, then it goes at 99 where it makes the program crashing with the follow message:

`
Unhandled exception in event loop:

Exception None
Press ENTER to continue...
`

I can put a try: big like an house in between all the code, but I still get that message that makes the app to crash.
Just try yourself that code I gave to you.

Honestly, I don't know if this is a libvte bug, but surely is something to investigate on.
Thank you.

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 linked gist with with patch_stdout(): in xfce4-terminal or gnome-terminal, then compare its behavior in xterm or Eterm and without patch_stdout(). Trace the unhandled event-loop exception while the loop prints 0 through 99; done means identifying the libvte-specific cause and fixing it or documenting the supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.