[Tutor] hello.py: line 1: print: command not found

Cullen Newsom cullennewsom at yahoo.com
Sun Dec 5 05:53:56 CET 2004


Max, 

    Thanks for your reply.  I have already tried to set my
shebang to /usr/bin/env python.  But for everyone's benefit. 
I've tried it again, and the same behavior persists.  As another
confirmation that this is not a file permission problem, I
should say that I can run hello.py as root, and get the expected
result.  I can also run it as normal user, from /usr/lib/python
and get the proper behavior.  It is from /home/user/hello.py
that this error persists.  I included below the attribute flags
from ls-l.  Thanks again for your help, any ideas are
appreciated.

Cullen

<file attributes>
nooseisloose at linux:~> ls -l hello.py
-rwxrwxrwx  1 nooseisloose users 42 2004-12-04 18:36 hello.py
</file attributes>

> On Dec 5, 2004, at 00:53, Cullen Newsom wrote:
> 
> > Hello List,
> >
> >     Here is my Error:
> > hello.py: line 1: print: command not found
> >     Here is my cat hello.py:
> > <cat hello.py>
> > nooseisloose at linux:~> cat hello.py
> > #!/usr/bin/python
> >
> > print "Hello, world!"
> >
> > nooseisloose at linux:~>
> > </cat hello.py>
> >
> >     I know this is a Linux question (or SuSE question) as
> much
> > as a python question, but I do not think there is a more
> > appropriate place to ask this question, and hopefully it
> will
> > help save someone some time and frustration, especially
> since a
> > person new to Python might well believe it to be a problem
> with
> > Python.
> >     Anyone know the proper thing to set, or change?  Thanks.
> >
> > Cullen
> 
> 	How are you running your script? Are you doing a basic
> "python 
> Hello.py", or have you set Hello.py to +x and are you relying
> on the 
> first line to tell the script where the Python interpreter is?
> 
> 	If it's answer #2, you should try replacing your first line
> with 
> "#!/usr/bin/env python" , and see what happens.
> 
> -- Max
> maxnoel_fr at yahoo dot fr -- ICQ #85274019
> "Look at you hacker... A pathetic creature of meat and bone,
> panting 
> and sweating as you run through my corridors... How can you
> challenge a 
> perfect, immortal machine?"



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250


More information about the Tutor mailing list