[Byte-of-Python] Mistake in she-bang line
cpghost at cordula.ws
cpghost at cordula.ws
Wed Feb 16 23:43:34 EST 2005
On Wed, Feb 16, 2005 at 04:50:35PM -0800, Swaroop C H wrote:
> > With python, things are (fortunately) not that bad (yet!).
> > Teaching people to use #!/usr/bin/env python instead
> > of #!/usr/bin/python from the very beginning would be a
> > great thing to do.
>
> I agree this is the right method.
>
> However, this didn't work in one particular instance for me - when I cron-ned
> the script on a FreeBSD box. It gave me an error but when I switched back to
> the physical location directly, it worked.
This normally happens when the environment (PATH) has been sanitized
for some reason. cron may have used a restrictive environment with
a PATH that didn't include, say, /usr/local/bin. In this case, env
wouldn't be able to find /usr/local/bin/python.
That's why /usr/bin/env shouldn't be used in cgi scripts (most web
servers don't include /usr/local/bin in the PATH they pass to the
forked cgi process), but probably almost everywhere else it should.
> Still, '/usr/bin/env' would be the right thing to do. I'll make changes for the
> next edition of the book.
Great! :)
Cheers,
-cpghost.
--
Cordula's Web. http://www.cordula.ws/
More information about the Byte-of-Python
mailing list