[Pythonmac-SIG] Cant open file

Chris Rebert pythonmac at rebertia.com
Sat Jun 20 20:09:27 CEST 2009


On Sat, Jun 20, 2009 at 10:39 AM, beegee beegee<bgquest at gmail.com> wrote:
> Hello,
> I am new to python, I have a mac os tiger 10.4.11
> I created a simple text file using textwrangler
> and wrote the following code :
>
> print "Hello World"
>
> I saved this file on my desktop as first_print.py
> I opened terminal
> I typed python
> and I got >>> as the prompt
> I typed python first_print.py
> and I got the following error message:
>
> python first_print.py
> /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python:
> can't open file 'first_print.py': [Errno 2] No such file or directory
>
> please help
> Also please let me know as to what is this error message for? what does it
> tell a user

"python first_print.py" is a command to be run in the *bash* shell
(i.e. raw Terminal). When you do "python" in Terminal, you've opened
Python itself, so it makes no sense to then try and run a shell
command from within Python itself.

So, to run your program:
1. Open Terminal
2. cd Desktop
3. python first_print.py

Cheers,
Chris
-- 
http://blog.rebertia.com


More information about the Pythonmac-SIG mailing list