Skip to Content.
Sympa Menu

byte-of-python - Re: [Byte-of-Python] Mistake in she-bang line

byte-of-python AT lists.ibiblio.org

Subject: Discussion regarding the book 'A Byte of Python'

List archive

Chronological Thread  
  • From: cpghost AT cordula.ws
  • To: Swaroop C H <swaroop AT swaroopch.info>
  • Cc: Discussion regarding the book 'A Byte of Python' <byte-of-python AT lists.ibiblio.org>
  • Subject: Re: [Byte-of-Python] Mistake in she-bang line
  • Date: Thu, 17 Feb 2005 05:43:34 +0100

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/




Archive powered by MHonArc 2.6.24.

Top of Page