Python 101: Can’t open file: No such file or directory

here’s a quick background: I am on day 1 of learning Python. No prior coding experience. Running Windows 8. Python 2.7 installed (location: C:\Python27). I have added the path “C:\Python27\;” to the environment variables and ‘.py:’ to PATHEXT. I am able to launch Python.

To learn, I’m starting with the Google Developers course on Python. I’ve downloaded the google-python-exercises file to my desktop which has a file ‘hello.py’. The Google page(https://developers.google.com/edu/python/set-up) says I should be able to enter ‘python hello.py’ in the command prompt and it should print ‘Hello World’.

When I attempt this, I get the message: python: can't open file 'hello.py: [Errno 2] No such file or directory. How can I fix this?

Update

I’m able to run it by running cmd from the folder. However, this seems to be a temporary solution. How do I program Python to take a new folder (C:\Python27\MyProjects) and search it? It sounds like I need to add/edit a directory, but I’m not sure how to do this.

Leave a Comment