Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Executing python scripts

Reply
Thread Tools

Executing python scripts

 
 
Shufen
Guest
Posts: n/a
 
      10-22-2004
Hi,

Can someone please advice me on the differences between this:
#!/usr/bin/env python and these: #!/usr/local/bin/python or
#!/usr/bin/python?

I know the first one locates the Python interpreter according to my
system searching path setting. But I read about an article that
mentioned that if we are running the scripts as a CGI from a Web
server then we should use the latter one. Because I'm using python
scripts as a CGI now and I'm currently using #!/usr/bin/env python
this and it seems fine to me, so I would like to know if there is any
difference.

Thank you for any help.



Shufen
 
Reply With Quote
 
 
 
 
Alex Martelli
Guest
Posts: n/a
 
      10-22-2004
Shufen <(E-Mail Removed)> wrote:

> Hi,
>
> Can someone please advice me on the differences between this:
> #!/usr/bin/env python and these: #!/usr/local/bin/python or
> #!/usr/bin/python?
>
> I know the first one locates the Python interpreter according to my
> system searching path setting. But I read about an article that


Right. The other two hardwire the location. The first will not work on
an installation which only has Python in /usr/bin, and viceversa.

> mentioned that if we are running the scripts as a CGI from a Web
> server then we should use the latter one. Because I'm using python
> scripts as a CGI now and I'm currently using #!/usr/bin/env python
> this and it seems fine to me, so I would like to know if there is any
> difference.


As long as you control your PATH, and what gets installed where in
directories along your PATH, you should be fine.


Alex
 
Reply With Quote
 
 
 
 
Peter Hansen
Guest
Posts: n/a
 
      10-22-2004
Alex Martelli wrote:
> Shufen <(E-Mail Removed)> wrote:
>
>
>>Hi,
>>
>>Can someone please advice me on the differences between this:
>>#!/usr/bin/env python and these: #!/usr/local/bin/python or
>>#!/usr/bin/python?
>>
>>I know the first one locates the Python interpreter according to my
>>system searching path setting. But I read about an article that

>
> Right. The other two hardwire the location. The first will not work on
> an installation which only has Python in /usr/bin, and viceversa.


To clarify (since I misunderstood this when I first read it): Alex
means "the first of the these", referring to the two that don't
look in the search path, when he writes "the first" (and not the
previously referenced "first one" as it seems, at first .

-Peter
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing Python Scripts on Mac using Python Launcher David Thomas Python 20 06-27-2012 09:33 PM
executing python scripts within wx frames Astan Chee Python 0 07-13-2010 03:15 PM
Using Python Scripts with IIS - ASP or Python-based CGI scripts withIIS - which makes more sense? davidj411 Python 0 06-27-2008 04:38 PM
Stupid question: Making scripts python-scripts Jan Danielsson Python 8 07-22-2005 12:20 AM
Re: Stupid question: Making scripts python-scripts Jp Calderone Python 0 07-21-2005 02:38 PM



Advertisments