Skip to content Skip to sidebar Skip to footer

How Can I Run My Currently Edited File In A Pycharm Console In A Way That I Can Type Into The Command Line Afterwards?

I want this so I can retain the command line history after repeated runs, and to paste lines from the console into tests etc. Exactly like in IDLE. [I realize this question is basi

Solution 1:

Shift+Alt+Ewould execute the selected code.

Solution 2:

Select the code fragment or the entire file, then use Execute Selection in Console from the context menu.

Solution 3:

For anyone still having this problem: Go to the Run/Debug menu, choose Edit Configuration, check the box 'Show command line' this will enable you to enter parameters in the console at the >>> prompt and test your function.

Edit: To make this change apply to all your .py files (as this check box only applies to the current file you're working on) go to: Edit configuration, in the pop up you will see a menu tree on the left, select Defaults, then Python, then check the 'Show command line' box, this will make it the default setting whenever you open a .py file, (this feature should really be on by default!)

Post a Comment for "How Can I Run My Currently Edited File In A Pycharm Console In A Way That I Can Type Into The Command Line Afterwards?"