avoiding long paths to interpreter

Erik Max Francis max at alcyone.com
Fri Jan 10 01:07:35 CET 2003

holger krekel wrote:

> Probably right, although one could try putting the below into
> a file:
> ------------------------------------------------------------
> #!/bin/sh
> # find a specific python version you want to use from
> # e.g. scanning PATH contents
> # but i am far too lazy to write shell scripts now
> # so i shortcut :-)
> python=/usr/bin/python
> $python <<__HERE__

But this is precisely what env does in the first place, so you might as
well just left the bangpath alone.

My point was not that using the (very common, and widely recommended)

	#!/usr/bin/env python

won't work, it's just that which Python interpreter it finds depends on
the PATH (because that is precisely what env does).  If you have
multiple intepreters installed, then you may get unpleasant surprises if
you're relying on finding a particular one, since PATHs will vary widely
from interactive shell to cron job to CGI script.

 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ The great floodgates of the wonder-world swung open.
\__/ Herman Melville
    CatCam / http://www.catcam.com/
 What do your pets do all day while you're at work?  Find out.

More information about the Python-list mailing list