Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51303

Re: Python Script Hashplings

Date 2013-07-26 14:53 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: Python Script Hashplings
References <51F12B41.3050004@Gmail.com> <51F12E31.1070502@mrabarnett.plus.com> <51F2517D.2070009@Gmail.com> <CAPTjJmo4epku6P1p34w8txvKA4DBbHNECoa33Qah_ReK8r+-vw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5146.1374846837.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 26/07/2013 11:43, Chris Angelico wrote:
> On Fri, Jul 26, 2013 at 11:37 AM, Devyn Collier Johnson
> <devyncjohnson@gmail.com> wrote:
>>
>> On 07/25/2013 09:54 AM, MRAB wrote:
>>>
>>> On 25/07/2013 14:42, Devyn Collier Johnson wrote:
>>>>
>>>> If I execute a Python3 script with this haspling (#!/usr/bin/python3.3)
>>>> and Python3.3 is not installed, but Python3.2 is installed, would the
>>>> script still work? Would it fall back to Python3.2?
>>>>
>>> Why don't you try it?
>>>
>>>> I hope Dihedral is listening. I would like to see another response from
>>>> HIM.
>>>>
>>>
>> Good point, but if it falls back to Python3.2, how would I know? Plus, I
>> have Python3.3, 3.2, and 2.7 installed. I cannot uninstall them due to
>> dependencies.
>
> Easy:
>
> #!/usr/bin/python3.3
> import sys
> print(sys.version)
>
> Now run that on lots of different computers (virtual computers work
> well for this).
>
There's also sys.version_info:

 >>> import sys
 >>> sys.version_info
sys.version_info(major=3, minor=3, micro=2, releaselevel='final', serial=0)

If you want to test what would happen if that version wasn't installed,
set the shebang line to a future version, such as Python 3.4. I doubt
you have that installed! :-)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python Script Hashplings MRAB <python@mrabarnett.plus.com> - 2013-07-26 14:53 +0100

csiph-web