Caleb
Caleb

Reputation: 39

Pycharm Python Console Won't Run Anything from Script

I am unable to get my pycharm console to access anything from my script. Likewise, when I tell a single line of code to execute in the console, an an error like the one shown in the image is thrown. I am sure that something is not configured correctly, and would appreciate any assistance.

enter image description here

Upvotes: 1

Views: 2323

Answers (2)

Houda
Houda

Reputation: 691

You don't need a python console. Just right click on the script name and select run or in pycharm terminal : python script.py It depends on your scrip

Upvotes: 0

Carcigenicate
Carcigenicate

Reputation: 45826

You have a generic console open that doesn't have your script loaded into in automatically. You can tell because the name of the console is "Python Console".

Right click on the code editor window, then at the bottom, click "Run file in Python Console". That will create a new console with the script loaded.

I made that into a key combination (in the Key Bindings in settings) because it's such a common task for me.

Upvotes: 1

Related Questions