Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Question for those who used Anaconda/Jupyter Notebook

I typed up the:

"print hello world" 

Inside my notepad (Windows 10) and I saved it under the "first_program.py" under "All Files" located in my desktop. When I type "python first_program.py" inside the Anaconda, this is the error I received:

"python: can't open file 'first_program.py' : [Errno 2] No such file or directory."

What are your thoughts on this?

Thanks!
It may be a bug, have you looked up the problem on google
you have to change directories to where it's located. say that it's saved in c:\Users\Username\Desktop

do this:

cd c:\Users\Username\Desktop

then run python, you have to run python in the same directory as the python script or give the absolute pathname of the file
(Nov 7, 2017 03:16 PM)majoreuphoria Wrote:  It may be a bug, have you looked up the problem on google

Most definitely. When I installed the Anaconda, it was installed in my PATH as well so I can run a .py file. But I'm not quite too sure why its not working...


(Nov 7, 2017 03:17 PM)lyft Wrote:  you have to change directories to where it's located. say that it's saved in c:\Users\Username\Desktop

do this:

cd c:\Users\Username\Desktop

then run python, you have to run python in the same directory as the python script or give the absolute pathname of the file

Perfect, it worked. Thank you for your help.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by SIM-3181517Jan 15, 2022 01:12 AM 0 95 Jan 15, 2022 01:12 AM
Last Post: SIM-3181517
[Python] by FinnTheHumanFeb 22, 2016 02:33 AM 2 63 Feb 22, 2016 02:33 AM
Last Post: SneakyPyro