Hack Forums
[Python] Question for those who used Anaconda/Jupyter Notebook - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Question for those who used Anaconda/Jupyter Notebook (/showthread.php?tid=5749335)



Question for those who used Anaconda/Jupyter Notebook - TopDawgg - Nov 7, 2017

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!


RE: Question for those who used Anaconda/Jupyter Notebook - majoreuphoria - Nov 7, 2017

It may be a bug, have you looked up the problem on google


RE: Question for those who used Anaconda/Jupyter Notebook - lyft - Nov 7, 2017

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


RE: Question for those who used Anaconda/Jupyter Notebook - TopDawgg - Nov 7, 2017

(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.