prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.13k stars 716 forks source link

AssertionError raised when using prompt in Pycharm #404

Open trbedwards opened 7 years ago

trbedwards commented 7 years ago

Trying the simple example in the documentation leads to an assertion error. Here is the example:

from __future__ import unicode_literals
from prompt_toolkit import prompt

text = prompt('Give me some input: ')
print('You said: %s' % text)

Here is the error:

File "/opt/anaconda/lib/python2.7/site-packages/prompt_toolkit/terminal/vt100_output.py", line 425, in from_pty
  assert stdout.isatty()
AssertionError

I am using prompt_toolkit version 1.0.7 and Pycharm 2016.2.2

stephenrauch commented 7 years ago

Pycharm does not give you a tty to work with. #396 solves this on Windows, but will be no help on other OSes.

dexpota commented 5 years ago

In my case, an easy solution was to enable the "Emulate terminal in output console" option in the *Run/Debug Configuration.

emulate_terminal

softmarshmallow commented 4 years ago

you can just run via console