how to run python script from Unix Shell?

Peter Hansen peter at engcorp.com
Fri Sep 7 10:02:05 EDT 2001


Joal Heagney wrote:
> 
> Peter Hansen wrote:
> > The other problem could be that your python is not
> > really in /usr/bin (type "which python" to be sure)
> > but then your error message would say:
> >
> > bash: ./test.py: No such file or directory
> >
> > (This all on Red Hat release 7.1.)
> 
> If this is so, you may want to try the magic hack
> #!/usr/bin/env python

Would this find the executable if it were not in the
path somewhere else?  If not, then it doesn't solve
the possible problem I described above.

Besides, then you have a bunch of scripts with 
non-conventional stuff in the first line, instead of
the "standard" #!/usr/bin/python.  Probably better
to just fix the environment to work with that, so 
you don't have to rewrite scripts you download, or
modify scripts you upload...

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list