I have written a .py file using Eclipse. I want to run that file in command prompt. How do I go about that? I'm running it on Windows.
I tried python D:\Python Work/class/src/hello.py The error I received was python: can't open file 'D:\Python':[Errno 2] No such file or directory. Also 'D:\Python' is not the entire address that I had specified.
Python was already been added to the PATH. I tried doing cd[file directory] and then python file.py but that gave me the same error
Thanks
Assuming you are running on windows - either:
python "D:\\Folder name\\Project name\\src\\module name.py"
Or:
python "D:/Folder name/Project name/src/module name.py"
Your choice basically.
The rules for windows file names are:
Back slashes, \
must be escaped by doubling to \\
spaces must be inside of double quotes "like this" quotes and few others need to be escaped as well and the extension does matter so give it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With