Most common #! format

Cameron Laird claird at starbase.neosoft.com
Thu Mar 2 23:06:41 EST 2000


In article <m12QWOK-000CnDC at artcom0.artcom-gmbh.de>,
Peter Funk <python-list at python.org> wrote:
>Hi!
>
>Chuck Esterbrook:
>> What's the most common #! format?
>> 
>> #!python
>> #!/usr/local/bin/python
>> #!/usr/bin/env python
>
>Since MacOS and Windows don't care about this very first line,
>this is only interesting to increase portability on unixoid platforms.  
Windows' command.com also supports analogous hackery,
yielding .bat sources which can act either as inde-
pendent executables or as well-formed Pyscripts.  I
have an allergic reaction to the syntactic contortions
involved, so I'll not give an example now.  Maybe we
should include one in the FAQ, though ...
			.
		[sage counsel on
		various more-or-
		less pertinent
		topics]
			.
			.
>mysterious security policy).  Under this rare circumstances the second
>form '#!/usr/local/bin/python' comes into play.  This would allow
>to call for example a CGI-script from a web server process, which 
>didn't has Python on its search path.  But this situation should 
>be considered as very exotic and rare today.
You just don't travel in the right (or wrong) circles
enough.  There are sites where ... well, I'll sum-
marize this way:  #! composition is like GUI toolkit
selection, in that different circumstances lead rea-
sonable people to different choices.  There's no one
right first-line.

Note that <URL:http://www.python.org/doc/FAQ.html#4.63>
also explains the 
  #! /bin/sh
  """:"
  exec python $0 ${1+"$@"}
  """                       
alternative which I favor.

Exercise for those designing a c.l.p reorganization:
should this thread take a home in .platform, .question,
.cgi, ...?
			.
			.
			.
-- 

Cameron Laird <claird at NeoSoft.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



More information about the Python-list mailing list