If I type python in windows cmd then it runs python fine, however I can't run any .py files in python. The files work with IDLE. I have set environment variables (to my knowledge, correctly). The files also don't run when I double click them nor if I say open with python. The script also run when I do ctrl + b in Sublime Text 2.
I've looked online for 2 days and can't fix it... maybe I am dumb. Please help!Dragging fails Tried to drag files into the python terminalruns in sublime Code runs in sublimechanged file names to run in python Tried different namesPython works Python works if I type python into windows cmd so path must work.listed in dir but doesn't detect shows the file is there, but the error is that it doesn't exist
42 Answers
The problem I can see here is most likely caused because you have whitespace in the script's name.
So the command line parses the name of the script up to the first word and thinks it is just Hello.
Try those two following things:
python "Hello World.py"or
python Hello\ World.pyThe quotes should "tell" the cmd that it is a single argument hence all of it is the name. Even if that doesn't work, the backslash just escapes the whitespace and that should work.
And another thing you could do is just rename the script to something like Hello_World.py - without any special symbols or whitespace.
I found a solution to my problem. I found it here:
After I followed this guide installing chocolatey and then others it fixed my problem.