script portability trick

Aahz Maruch aahz at
Thu Jan 17 15:24:07 EST 2002

In article <bebbba07.0201171203.4ce00461 at>,
Russ <18k11tm001 at> wrote:
>A traditional unix trick in Tcl/Tk is to start scripts like this:
># the next line starts wish \
>exec wish "$0" "$@"
>This causes the Bourne shell to search the user's executable path to
>find wish each time the script is executed. Because the script doesn't
>depend on wish being in a particular directory, it is more portable
>(sh is almost always in /bin, but wish can be anywhere).
>Is there a similar trick for Python? Thanks.

The standard gimmick for Python is:

#!/usr/bin/env python
                      --- Aahz  <*>  (Copyright 2002 by aahz at

Hugs and backrubs -- I break Rule 6       
Androgynous poly kinky vanilla queer het Pythonista   

"There are times when effort is important and necessary, but this should
not be taken as any kind of moral imperative."  --jdecker

More information about the Python-list mailing list