Stupid question: Making scripts python-scripts

bruno modulix onurb at xiludom.gro
Thu Jul 21 14:09:47 EDT 2005


Jan Danielsson wrote:
> Hello all,
> 
>    How do I make a python script actually a _python_ in unix:ish
> environments?
> 
> I know about adding:
> #!/bin/sh
> 
>    ..as the first row in a shell script, but when I installed python on
> a NetBSD system, I didn't get a "python" executable; only a "python2.4"
> executable.
> 
>    Adding "#!/usr/pkg/bin/python2.4" as the first row in the script
> would probably work, but that would be too specific for the system I'm
> using, imho.

What about:

ln /usr/pkg/bin/python2.4 /usr/bin/python

then
#!/usr/bin/python

in your script, and you should be done (dont forget to chmod +x your
script of course)

Or I'm I missing something specific to xxxBSD ?

>    I saw someone using "#!/usr/bin/env python", but that failed on the
> system I'm using, 

How do you execute the python interpreter ? If you need to type
"python2.4" (not just "python"), then obviously 'usr/bin/env python'
syntax shouldn't work either.

My 2 cents
-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list