Re: Running a python script under Linux

2012-12-14 Thread Hans Mulder
On 14/12/12 03:45:18, Steven D'Aprano wrote: I understand this is not exactly a Python question, but it may be of interest to other Python programmers, so I'm asking it here instead of a more generic Linux group. I have a Centos system which uses Python 2.4 as the system Python, so I set

Re: Running a python script under Linux

2012-12-14 Thread D'Arcy J.M. Cain
On Fri, 14 Dec 2012 14:18:28 +0100 Hans Mulder han...@xs4all.nl wrote: The Pythonic way to get what you want, is to be explicit: #!/usr/local/bin/python2.7 -V If you do that, it will even work in situations where you can't control PATH, such as CGI scripts and cron jobs. As long as you

Re: Running a python script under Linux

2012-12-14 Thread Hans Mulder
On 14/12/12 14:38:25, D'Arcy J.M. Cain wrote: On Fri, 14 Dec 2012 14:18:28 +0100 Hans Mulder han...@xs4all.nl wrote: The Pythonic way to get what you want, is to be explicit: #!/usr/local/bin/python2.7 -V If you do that, it will even work in situations where you can't control PATH, such as

Re: Running a python script under Linux

2012-12-14 Thread Michael Torrie
On 12/13/2012 07:45 PM, Steven D'Aprano wrote: When I call python some_script.py from the command line, it runs under Python 2.7 as I expected. So I give the script a hash-bang line: #!/usr/bin/env python and run the script directly, but instead of getting Python 2.7, it runs under

Re: Running a python script under Linux

2012-12-13 Thread Cameron Simpson
On 14Dec2012 02:45, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: | I understand this is not exactly a Python question, but it may be of | interest to other Python programmers, so I'm asking it here instead of a | more generic Linux group. | | I have a Centos system which uses

Re: Running a python script under Linux

2012-12-13 Thread Andrew Robinson
On 12/13/2012 06:45 PM, Steven D'Aprano wrote: I understand this is not exactly a Python question, but it may be of interest to other Python programmers, so I'm asking it here instead of a more generic Linux group. I have a Centos system which uses Python 2.4 as the system Python, so I set an

Re: Running a python script under Linux

2012-12-13 Thread Jussi Piitulainen
Steven D'Aprano writes: I have a Centos system which uses Python 2.4 as the system Python, so I set an alias for my personal use: [steve@ando ~]$ which python alias python='python2.7' /usr/local/bin/python2.7 When I call python some_script.py from the command line, it runs

Re: Running a python script under Linux

2012-12-13 Thread Andrew Robinson
On 12/13/2012 06:45 PM, Steven D'Aprano wrote: What am I doing wrong? By the way, I didn't include command line parameters as part of the function definition, so you might want to add them to insure it acts like a generic alias. Also, (alternately), you could define a generic python shell