On 04/12/2018 23:52, James Stapleton-Cotton wrote:

> USERs-MacBook-Pro:~ user$ python hello.py
> python: can't open file 'hello.py': [Errno 2] No such file or directory

You need to provide the full path to the Python file.

> I previously created a python file called 'hello.py' using the PyCharmEdu
> editor (as instructed). This file is saved in my 'Documents' in a folder
> called 'Pycharm Projects' 

So you would have needed to type

user$ python "~/Documents/Pycharm Projects/hello.py"

> to the original, 'PycharmProjects'.]

Note that here you omit the space.
The OS is very particular about such details, you need
to get it exactly right. (Although in bash using the
tab key will usually fill things in the way you need it)

> 'hello.py' file into the tmp folder and attempted the above process of
> 'running' the 'python hello.py' file from the terminal, however the same
> result occurred.

Again you needthe patg:

user$ python /tmp/py/hello.py

The other option is to change directory to where the code is and then
just specify the name:

user$ cd /tmp/py
user$ python hello.py

Should work too.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to