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

NoConsoleScreenBufferError when executing the hello world example in Windows.

Open
#406 22 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Running on python 3.4, I was having trouble with django's manage.py shell command. I've narrowed it down to the prompt_toolkit module and can demonstrate the problem with this simple code:

>>> import prompt_toolkit
>>> prompt_toolkit.prompt("Hi")
Hi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python34\lib\site-packages\prompt_toolkit\shortcuts.py", line 545, in prompt
    eventloop=eventloop)
  File "C:\Python34\lib\site-packages\prompt_toolkit\shortcuts.py", line 626, in run_application
    result = cli.run(reset_current_buffer=False)
  File "C:\Python34\lib\site-packages\prompt_toolkit\interface.py", line 391, in run
    self.renderer.request_absolute_cursor_position()
  File "C:\Python34\lib\site-packages\prompt_toolkit\renderer.py", line 343, in request_absolute_cursor_position
    self._min_available_height = self.output.get_rows_below_cursor_position()
  File "C:\Python34\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 287, in get_rows_below_cursor_position
    info = self.get_win32_screen_buffer_info()
  File "C:\Python34\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 150, in get_win32_screen_buffer_info
    raise NoConsoleScreenBufferError
prompt_toolkit.terminal.win32_output.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?
>>>

Let me know what other information I can provide

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 Windows failure with the minimal prompt_toolkit.prompt("Hi") example and inspect prompt_toolkit/terminal/win32_output.py, especially get_win32_screen_buffer_info and get_rows_below_cursor_position. Compare the behavior with django's manage.py shell context; done means the example no longer raises NoConsoleScreenBufferError in the reported Windows setup, with coverage for the relevant case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.