Windows 10 Issues Running Python Script from Console: Program Exits Unexpectedly

Kevin Hu

Well-Known Member
Joined
Jan 17, 2016
Messages
11
Hey guys, I installed Python and I had some problems with running it form the console. It runs perfectly fine with IDLE 32 bit, but when I saved it and run from Python, it flashes and exit the program. I attached a video to show what's wrong.
 

Attachments

Solution
I would open a command prompt and just type python if you get a >>> prompt then python is in the path variable. if it errors out you need to add the path to the python executable to the path environment variable. If you don't get an error then type python <your python file> and see of it generates an error.

Kevin Hu

Well-Known Member
Joined
Jan 17, 2016
Messages
11
I don't know what that is. I attached the file of code I wrote. I don't know if it's the language compatibility(the code is in Chinese) or the python itself.
 

Attachments

Kevin Hu

Well-Known Member
Joined
Jan 17, 2016
Messages
11
I don't know what that is. I attached the file of code I wrote. I don't know if it's the language compatibility(the code is in Chinese) or the python itself.
 

Attachments

Neemobeer

Windows Forum Team
Staff member
Joined
Jul 4, 2015
Messages
8,998
I would open a command prompt and just type python if you get a >>> prompt then python is in the path variable. if it errors out you need to add the path to the python executable to the path environment variable. If you don't get an error then type python <your python file> and see of it generates an error.
 

Solution

Kevin Hu

Well-Known Member
Joined
Jan 17, 2016
Messages
11
My command prompt run python just fine. But when I drag the .py file to command prompt. It says "File "<stdin>", line 1 syntax error: invalid syntax. When I tested in idle, there's no syntax error
 

Neemobeer

Windows Forum Team
Staff member
Joined
Jul 4, 2015
Messages
8,998
If you're trying to run it from within the interpreter you will get this error.
 

Back
Top