Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-30 Thread Matej Cepl
On 28/09/12 12:57, Roy Smith wrote: But, you might as well get into the habit of using the /usr/bin/env flavor because it's more flexible. In the same manner as one's freedom-fighter is another's fundamentalist terrorist, what's flexible could be also dangerous. E.g., #!/usr/bin/env python

#!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Gilles
Hello I've seen both shebang lines to run a Python script on a *nix host: #!/usr/bin/env python #!/usr/bin/python What's the difference? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Jussi Piitulainen
Gilles writes: #!/usr/bin/env python #!/usr/bin/python What's the difference? Not much if your python is /usr/bin/python: env looks for python and finds the same executable. When python is not /usr/bin/python but something else that is still found by your system, /usr/bin/env still finds

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Roy Smith
In article 34va6856ocuas7jpueujscf3kdt7k44...@4ax.com, Gilles nos...@nospam.com wrote: Hello I've seen both shebang lines to run a Python script on a *nix host: #!/usr/bin/env python #!/usr/bin/python What's the difference? The first one looks through your PATH to find the right

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Gilles
On Fri, 28 Sep 2012 06:57:28 -0400, Roy Smith r...@panix.com wrote: The first one looks through your PATH to find the right python interpreter to run. The second one is hard-wired to run /usr/bin/python. If you only have a single copy of python installed, it doesn't really matter which you

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread D'Arcy Cain
On Fri, 28 Sep 2012 06:57:28 -0400 Roy Smith r...@panix.com wrote: I've seen both shebang lines to run a Python script on a *nix host: #!/usr/bin/env python #!/usr/bin/python What's the difference? The first one looks through your PATH to find the right python interpreter to

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Gilles
On Fri, 28 Sep 2012 09:19:54 -0400, D'Arcy Cain da...@druid.net wrote: Not just flexible but portable. On various systems I have Python in /usr/bin, /usr/local/bin and /usr/pkg/bin. #!/usr/bin/env python finds it in each case so I only need one version of the script. Good to know. --

Re: #!/usr/bin/env python vs. #!/usr/bin/python?

2012-09-28 Thread Demian Brecht
On 12-09-28 06:19 AM, D'Arcy Cain wrote: Not just flexible but portable. On various systems I have Python in /usr/bin, /usr/local/bin and /usr/pkg/bin. #!/usr/bin/env python finds it in each case so I only need one version of the script. +1. This also resolves correctly on Cygwin, even if

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-09 Thread Tim Roberts
Brian Vanderburg II [EMAIL PROTECTED] wrote: D'Arcy J.M. Cain wrote: Brian Vanderburg II [EMAIL PROTECTED] wrote: This is sort of related, but I'm wondering what is different between #!/usr/bin/env python and #!python. Wouldn't the second do the same thing, since an absolute path is not

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-08 Thread Brian Vanderburg II
This is sort of related, but I'm wondering what is different between #!/usr/bin/env python and #!python. Wouldn't the second do the same thing, since an absolute path is not specified, find 'python' from the PATH environment, I don't really know. Brian Vanderburg II --

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-08 Thread Michael Mabin
For me, the difference is #!python doesn't work for me. I get a bad interpreter error. On Thu, May 8, 2008 at 6:31 AM, Brian Vanderburg II [EMAIL PROTECTED] wrote: This is sort of related, but I'm wondering what is different between #!/usr/bin/env python and #!python. Wouldn't the second do

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-08 Thread D'Arcy J.M. Cain
On Thu, 08 May 2008 07:31:17 -0400 Brian Vanderburg II [EMAIL PROTECTED] wrote: This is sort of related, but I'm wondering what is different between #!/usr/bin/env python and #!python. Wouldn't the second do the same thing, since an absolute path is not specified, find 'python' from the

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-08 Thread Brian Vanderburg II
D'Arcy J.M. Cain wrote: On Thu, 08 May 2008 07:31:17 -0400 Brian Vanderburg II [EMAIL PROTECTED] wrote: This is sort of related, but I'm wondering what is different between #!/usr/bin/env python and #!python. Wouldn't the second do the same thing, since an absolute path is not specified,

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-06 Thread Banibrata Dutta
On 5/6/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: At our site we run IRIX, UNICOS, Solaris, Tru64, Linux, cygwin and other unixy OSes. We have python installed in a number of different places: /bin/python /usr/local/bin/python /usr/bin/python

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-06 Thread Wojciech Walczak
2008/5/6, Banibrata Dutta [EMAIL PROTECTED]: Use /usr/bin/env. If env is not in /usr/bin, put a link to it there. So why not put symlink to Python over there on all machines, if we can put one (or env itself) there ? To avoid linking all the rest of interpreters like perl, ruby, lua and

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-06 Thread Ben Finney
Wojciech Walczak [EMAIL PROTECTED] writes: 2008/5/6, Banibrata Dutta [EMAIL PROTECTED]: Use /usr/bin/env. If env is not in /usr/bin, put a link to it there. So why not put symlink to Python over there on all machines, if we can put one (or env itself) there ? To avoid linking all

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-06 Thread Wojciech Walczak
2008/5/6, Ben Finney [EMAIL PROTECTED]: So why not put symlink to Python over there on all machines, if we can put one (or env itself) there ? To avoid linking all the rest of interpreters like perl, ruby, lua and dozens of others. The argument was being made from thousands of

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-06 Thread Ethan Furman
Banibrata Dutta wrote: On 5/6/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: At our site we run IRIX, UNICOS, Solaris, Tru64, Linux, cygwin and other unixy OSes. We have python installed in a number of different places: /bin/python /usr/local/bin/python /usr/bin/python

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-06 Thread andrej . panjkov
On May 6, 9:06 pm, Ben Finney [EMAIL PROTECTED] wrote: Wojciech Walczak [EMAIL PROTECTED] writes: 2008/5/6, Banibrata Dutta [EMAIL PROTECTED]: Use /usr/bin/env. If env is not in /usr/bin, put a link to it there. So why not put symlink to Python over there on all machines, if we

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-05 Thread andrej . panjkov
At our site we run IRIX, UNICOS, Solaris, Tru64, Linux, cygwin and other unixy OSes. We have python installed in a number of different places: /bin/python /usr/local/bin/python /usr/bin/python /opt/freeware/Python/Python-2.5.1/bin/python ~mataap/platform/python/python-2.5.1 So I cannot assume a

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-03 Thread Ben Finney
Ben Finney [EMAIL PROTECTED] writes: The shebang line (the initial line of the file beginning with #!) takes advantage of OS kernels that determine how to execute a file based on the first few bytes of the file. The shebang line tells the kernel that this file should be executed by passing it

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-03 Thread Torsten Bronger
Hallöchen! Gabriel Genellina writes: [...] I can't believe some angry responses in this thread - it's just a technical question, not about which is the best team in the [preferred sports here] National Championship... Well, Python-list is tunnelled to Usenet. Welcome here. ;-) Tschö,

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-03 Thread Lou Pecora
In article [EMAIL PROTECTED], Grant Edwards [EMAIL PROTECTED] wrote: On 2008-05-02, D'Arcy J.M. Cain [EMAIL PROTECTED] wrote: On Sat, 03 May 2008 00:44:00 +1000 Ben Finney [EMAIL PROTECTED] wrote: D'Arcy J.M. Cain [EMAIL PROTECTED] writes: As someone else pointed out, not all the world

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-03 Thread Michael Mabin
I work on an AIX system where /usr/bin and /usr/local/bin apps can only be installed by root. Our system doesn't have python or many other tools we like to use installed so we have to install python in an alternate directory location. We have a system installation of Perl installed, but it's a

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-03 Thread Aahz
In article [EMAIL PROTECTED], Gabriel Genellina [EMAIL PROTECTED] wrote: I can't believe some angry responses in this thread - it's just a technical question, not about which is the best team in the [preferred sports here] National Championship...

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Jeroen Ruigrok van der Werven
-On [20080502 07:51], Ben Finney ([EMAIL PROTECTED]) wrote: To my mind, the Python interpreter installed by a package as distributed with the OS *is* OS territory and belongs in /usr/bin/. That's the difference with a distribution, such as Linux, and full OSes , such as BSDs or commercial Unix

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Duncan Booth
Yves Dorfsman [EMAIL PROTECTED] wrote: On UNIX, some people use #!/usr/bin/env python While other use #!/usr/bin/python Why is one preferred over the other one ? I don't think the answers so far have communicated what I believe to be the important point: it isn't that one is always

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Ben Finney
Jeroen Ruigrok van der Werven [EMAIL PROTECTED] writes: -On [20080502 07:51], Ben Finney ([EMAIL PROTECTED]) wrote: To my mind, the Python interpreter installed by a package as distributed with the OS *is* OS territory and belongs in /usr/bin/. That's the difference with a distribution,

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread D'Arcy J.M. Cain
On Fri, 02 May 2008 15:50:22 +1000 Ben Finney [EMAIL PROTECTED] wrote: You have lived a sheltered life. Not every packaging system puts the executible in /usr/bin. Many systems use /usr/local/bin. They use that for the operating-system-installed default Python interpreter? Colour me

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Ben Finney
D'Arcy J.M. Cain [EMAIL PROTECTED] writes: On Fri, 02 May 2008 13:24:01 +1000 Ben Finney [EMAIL PROTECTED] wrote: I much prefer #! /usr/bin/python because I want my Python programs to, by default, be run with the default Python, and depend on Python being installed by the operating

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Thorsten Kampe
* Ben Finney (Fri, 02 May 2008 23:30:01 +1000) The OP was asking why people prefer on over the other. My answer is that I prefer specifying give me the default OS Python because anything not installed by the OS is to non-standardised for me to worry about. Others may prefer something

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Roy Smith
In article [EMAIL PROTECTED], Ben Finney [EMAIL PROTECTED] wrote: Whereas if Python is *not* installed from an OS package, it's up to the sys admin to ensure that it works -- not up to my program. So I don't see the point in making it work by default, when what I want for my program is that

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread D'Arcy J.M. Cain
On Fri, 02 May 2008 23:30:01 +1000 Ben Finney [EMAIL PROTECTED] wrote: The OP was asking why people prefer on over the other. My answer is that I prefer specifying give me the default OS Python because anything not installed by the OS is to non-standardised for me to worry about. As someone

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Torsten Bronger
Hallöchen! D'Arcy J.M. Cain writes: On Fri, 02 May 2008 23:30:01 +1000 Ben Finney [EMAIL PROTECTED] wrote: The OP was asking why people prefer on over the other. My answer is that I prefer specifying give me the default OS Python because anything not installed by the OS is to

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Ben Finney
Thorsten Kampe [EMAIL PROTECTED] writes: * Ben Finney (Fri, 02 May 2008 23:30:01 +1000) The OP was asking why people prefer on over the other. My answer is that I prefer specifying give me the default OS Python because anything not installed by the OS is to non-standardised for me to

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Grant Edwards
On 2008-05-02, Ben Finney [EMAIL PROTECTED] wrote: The specified command takes the form of a fully-qualified file path, and zero or one arguments to the program. That command is then executed by the kernel, and the Python program file is passed as input to the resulting process. Just to

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Ben Finney
Roy Smith [EMAIL PROTECTED] writes: In article [EMAIL PROTECTED], Ben Finney [EMAIL PROTECTED] wrote: Whereas if Python is *not* installed from an OS package, it's up to the sys admin to ensure that it works -- not up to my program. So I don't see the point in making it work by

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Ben Finney
D'Arcy J.M. Cain [EMAIL PROTECTED] writes: On Fri, 02 May 2008 23:30:01 +1000 Ben Finney [EMAIL PROTECTED] wrote: The OP was asking why people prefer on over the other. My answer is that I prefer specifying give me the default OS Python because anything not installed by the OS is [too]

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Grant Edwards
On 2008-05-02, Jeroen Ruigrok van der Werven [EMAIL PROTECTED] wrote: I've never clearly understood why people want to use #! /usr/bin/env python, which is prone to finding a different Python from the one installed by the operating system. I'd be interested to see what responses are in favour of

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Grant Edwards
On 2008-05-02, Jeroen Ruigrok van der Werven [EMAIL PROTECTED] wrote: -On [20080502 07:51], Ben Finney ([EMAIL PROTECTED]) wrote: To my mind, the Python interpreter installed by a package as distributed with the OS *is* OS territory and belongs in /usr/bin/. That's the difference with a

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread D'Arcy J.M. Cain
On Fri, 02 May 2008 16:26:51 +0200 Torsten Bronger [EMAIL PROTECTED] wrote: Certainly #! /usr/bin/python is fine if you never expect your software to run outside of your own little corner of the world but you asked why people prefer the env version and the answer is that we want to write

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Torsten Bronger
Hallöchen! D'Arcy J.M. Cain writes: On Fri, 02 May 2008 16:26:51 +0200 Torsten Bronger [EMAIL PROTECTED] wrote: Certainly #! /usr/bin/python is fine if you never expect your software to run outside of your own little corner of the world but you asked why people prefer the env version and

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread D'Arcy J.M. Cain
On Sat, 03 May 2008 00:44:00 +1000 Ben Finney [EMAIL PROTECTED] wrote: D'Arcy J.M. Cain [EMAIL PROTECTED] writes: As someone else pointed out, not all the world is Linux. It's a good thing I've never implied such to be the case. You haven't *said* it but you have definitely *implied* it.

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread D'Arcy J.M. Cain
On Sat, 03 May 2008 00:43:02 +1000 Ben Finney [EMAIL PROTECTED] wrote: Roy Smith [EMAIL PROTECTED] writes: Have you ever shipped software to a customer? Yes, and all parties have been quite happy with the results. When some of us talk about shipping software we aren't talking about a 20

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Grant Edwards
On 2008-05-02, D'Arcy J.M. Cain [EMAIL PROTECTED] wrote: On Sat, 03 May 2008 00:44:00 +1000 Ben Finney [EMAIL PROTECTED] wrote: D'Arcy J.M. Cain [EMAIL PROTECTED] writes: As someone else pointed out, not all the world is Linux. It's a good thing I've never implied such to be the case.

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Yves Dorfsman
Thanks everybody, I didn't mean to start a flamewar... I do get it now, it's whatever python is in the path, vs. the specific one you're pointing to. Ben Finney wrote: No, because it's quite common for the PATH variable to have '/usr/local/bin' appear *before* both of '/bin' and '/usr/bin'.

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Thorsten Kampe
* Ben Finney (Sat, 03 May 2008 00:37:45 +1000) Thorsten Kampe [EMAIL PROTECTED] writes: * Ben Finney (Fri, 02 May 2008 23:30:01 +1000) The OP was asking why people prefer on over the other. My answer is that I prefer specifying give me the default OS Python because anything not

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Carl Banks
On May 2, 11:07 am, D'Arcy J.M. Cain [EMAIL PROTECTED] wrote: On Sat, 03 May 2008 00:43:02 +1000 Ben Finney [EMAIL PROTECTED] wrote: Roy Smith [EMAIL PROTECTED] writes: Have you ever shipped software to a customer? Yes, and all parties have been quite happy with the results. When some

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Erik Max Francis
Ben Finney wrote: No, because it's quite common for the PATH variable to have '/usr/local/bin' appear *before* both of '/bin' and '/usr/bin'. If the system has a sysadmin-installed '/usr/local/bin/python' installed as well as the OS-installed '/usr/bin/python', then the two shebang options the

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Robert Kern
Yves Dorfsman wrote: On UNIX, some people use #!/usr/bin/env python While other use #!/usr/bin/python Why is one preferred over the other one ? Caveat: I've only read *most* of this thread, so maybe someone else has already made the following point. It depends on the context. Ultimately,

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Ben Finney
D'Arcy J.M. Cain [EMAIL PROTECTED] writes: On Sat, 03 May 2008 00:43:02 +1000 Ben Finney [EMAIL PROTECTED] wrote: Roy Smith [EMAIL PROTECTED] writes: Have you ever shipped software to a customer? Yes, and all parties have been quite happy with the results. When some of us talk

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 12:07:55 -0300, D'Arcy J.M. Cain [EMAIL PROTECTED] escribió: On Sat, 03 May 2008 00:43:02 +1000 Ben Finney [EMAIL PROTECTED] wrote: Roy Smith [EMAIL PROTECTED] writes: Have you ever shipped software to a customer? Yes, and all parties have been quite happy with the

#!/usr/bin/env python vs. #!/usr/bin/python

2008-05-01 Thread Yves Dorfsman
On UNIX, some people use #!/usr/bin/env python While other use #!/usr/bin/python Why is one preferred over the other one ? Thanks. -- Yves. http://www.SollerS.ca -- http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-01 Thread J Sisson
The first method allows python to be installed in an alternate location (i.e. /usr/local/bin). env in this case is being used to launch python from whatever location python is installed to. I like to think of it as an abstraction of the python location to make it multiplatform-friendly since not

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-01 Thread Ben Finney
Yves Dorfsman [EMAIL PROTECTED] writes: On UNIX, some people use #!/usr/bin/env python While other use #!/usr/bin/python You haven't indicated your understanding of what the difference in meaning is, so I'll explain it for those who might not know. The shebang line (the initial line of

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-01 Thread Roy Smith
In article [EMAIL PROTECTED], Ben Finney [EMAIL PROTECTED] wrote: I've never clearly understood why people want to use #! /usr/bin/env python, which is prone to finding a different Python from the one installed by the operating system. I'd be interested to see what responses are in favour of

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-01 Thread D'Arcy J.M. Cain
On Fri, 02 May 2008 13:24:01 +1000 Ben Finney [EMAIL PROTECTED] wrote: I much prefer #! /usr/bin/python because I want my Python programs to, by default, be run with the default Python, and depend on Python being installed by the operating system's package manager. On systems that use shebang

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-01 Thread Jeroen Ruigrok van der Werven
-On [20080502 05:26], Ben Finney ([EMAIL PROTECTED]) wrote: I've never clearly understood why people want to use #! /usr/bin/env python, which is prone to finding a different Python from the one installed by the operating system. I'd be interested to see what responses are in favour of it, and

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-01 Thread Tim Roberts
Yves Dorfsman [EMAIL PROTECTED] wrote: On UNIX, some people use #!/usr/bin/env python While other use #!/usr/bin/python Why is one preferred over the other one ? The /usr/bin/env solution finds the Python interpreter anywhere on the PATH, whether it be /usr/bin or /usr/local/bin, or whatever.

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-01 Thread Ben Finney
Jeroen Ruigrok van der Werven [EMAIL PROTECTED] writes: -On [20080502 05:26], Ben Finney ([EMAIL PROTECTED]) wrote: I've never clearly understood why people want to use #! /usr/bin/env python, which is prone to finding a different Python from the one installed by the operating system. I'd be

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-01 Thread Ben Finney
D'Arcy J.M. Cain [EMAIL PROTECTED] writes: On Fri, 02 May 2008 13:24:01 +1000 Ben Finney [EMAIL PROTECTED] wrote: I much prefer #! /usr/bin/python because I want my Python programs to, by default, be run with the default Python, and depend on Python being installed by the operating