prompt-toolkit / prompt-toolkit/python-prompt-toolkit
prompt_toolkit.output.win32.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
I am using this application for loading languagemodels and interacting with them in the terminal.
When I am working in Windows 11 and I reload several languagemodels, I get the following error:
File "c:\Users\.venv\Lib\site-packages\prompt_toolkit\application\application.py", line 300, in __init__
self.renderer = Renderer(
^^^^^^^^^
File "c:\Users\venv\Lib\site-packages\prompt_toolkit\renderer.py", line 325, in __init__
self.reset(_scroll=True)
File "c:\Users\.venv\Lib\site-packages\prompt_toolkit\renderer.py", line 351, in reset
self.output.scroll_buffer_to_prompt()
File "c:\Users\.venv\Lib\site-packages\prompt_toolkit\output\win32.py", line 339, in scroll_buffer_to_prompt
info = self.get_win32_screen_buffer_info()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\.venv\Lib\site-packages\prompt_toolkit\output\win32.py", line 191, in get_win32_screen_buffer_info
raise NoConsoleScreenBufferError
prompt_toolkit.output.win32.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?
Some interesting observations:
- The issue only seems to happen on Windows and not on Unix-systems
- The error interestingly doesnt to happen when I use the latest major version 2 (2.0.10), but does on 3.0.0.
I know python can be notorious for not returning all memory back to the user when working with bigger objects, so I figure this might seem to be related to the issue.
In my own code, I tried several ways to delete the bigger objects from memory. use del on everything in combination with gc.collect, but nothing seems to change this error aside from changing back to version 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Windows paths shown in prompt_toolkit/output/win32.py, especially get_win32_screen_buffer_info and scroll_buffer_to_prompt, then trace their callers in renderer.py and application.py. Compare the behavior between versions 2.0.10 and 3.0.0 under the reported Windows 11 conditions. Done means identifying the version regression and adding or updating coverage for the missing-console case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100