python-prompt-toolkit: NoConsoleScreenBufferError when executing the hello world example in Windows.

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

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Reactions: 1
  • Comments: 22 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I just saw, that you can check “Emulate terminal in output console” in your run/debug configuration to fix this error in PyCharm. For me this works.

image

Hi @jonathanslenders, I am facing this issue while running the python script from pyCharm. Not happening when directly ran from cmd.

@jonathanslenders

This is under W10 x64, Python 2.7.1x, and i did launch it from cmd from admin account. I’ll try later using a regular user, maybe something changes, but i don’t expect anything to run bad from admin… usually it’s the opposite, and also changed cwd to User folder but didn’t change anything.

I can try whatever you suggest. I don’t really need ipython over this laptop with Windows, but i am also curious to know which kind of shit is under the hood 😃 and wondering it’s Windows fault 😃

Regards