Robinson
Robinson

Reputation: 379

Interacting with program after execution

In PyCharm, after I run a script it automatically kills it:

C:\Users\Sean.virtualenvs\Stanley\Scripts\python.exe C:/Users/Sean/PycharmProjects/Stanley/Stanley.py

Process finished with exit code 0

How can I interact with the script after it starts? For lack of a better way to phrase it, how can I get the

>>>

prompt after the script runs once through?

Upvotes: 30

Views: 18898

Answers (3)

Piotr Dobrogost
Piotr Dobrogost

Reputation: 42425

UPDATE
Starting with version 4.0 there's an option Show command line afterwards (renamed in later versions to Run with Python console) when editing run/debug configuration in Run|Edit Configurations....


From output of python --help:

-i : inspect interactively after running script; forces a prompt even if stdin does not appear to be a terminal; also PYTHONINSPECT=x

To set interpreter option in PyCharm go to Run|Edit Configuration

Upvotes: 32

Xiangyi Yan
Xiangyi Yan

Reputation: 141

Click Run -> Edit Configurations...,

Then check the box Run with Python console.

Upvotes: 11

ling
ling

Reputation: 489

in Pycharm, Run/Debug menu choose Edit Configuration, check the box before 'Show command line afterwards'

Upvotes: 38

Related Questions