How to run python program in terminal instead of console

Answered

I am currently developing python commandline interface using python cmd2 module. It seems like the console feature in pycharm is not tty compatible thus cannot display features such as command prompts (i.e. <user>@<hostname>:~/$). Is it possible to launch the application in external terminal instead? Is there other workaround to make development for these applications easier?

4 comments

There is a registry key (Find action 'Registry' in PyCharm) named 'run.processes.with.pty'. Try setting it to 'true'

0

Hi Dmitry, 

     Thank you for the tip. After modifying the registry key and setting the 'run.processes.with.pty' definitely helped significantly, however, it does not fix all the issues. I also found that enabling "Emulate terminal in output console" fixes some additional errors while 'run.processes.with.pty' is set to true. With these two fixes applied, the console is almost usable for development purpose.

The major left over issue after applying the above "fixes" is "phantom" <ENTER> key presses. The incorrect behavior is an additional <ENTER> added for every command entered via stdin.

Expected behavior Ex:

(cmd) test_command1<Enter>

stdout output

(cmd) test_command2<Enter>

stdout output

 

Incorrect behavior Ex:

(cmd) test_command1<Enter>

stdout output

(cmd) 

(cmd) test_command2<Enter>

stdout output

(cmd)

 

 

 

0

Hi Jack, the issue sounds similar to PY-27140, please feel free to comment/vote.

0

Hi Pavel, PY-27140 is indeed describing the same issue which I encountered. Thanks.

0

Please sign in to leave a comment.