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


Groups > comp.lang.python > #51296 > unrolled thread

Re: Python Script Hashplings

Started byTim Golden <mail@timgolden.me.uk>
First post2013-07-26 11:47 +0100
Last post2013-07-26 11:47 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Python Script Hashplings Tim Golden <mail@timgolden.me.uk> - 2013-07-26 11:47 +0100

#51296 — Re: Python Script Hashplings

FromTim Golden <mail@timgolden.me.uk>
Date2013-07-26 11:47 +0100
SubjectRe: Python Script Hashplings
Message-ID<mailman.5143.1374835648.3114.python-list@python.org>
On 26/07/2013 11:37, Devyn Collier Johnson 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.

Devyn, I'm not a *nix person so someone can point out if I'm wrong, but
my understanding is that the shebang line (or whatever you want to call
it) just tells the shell: run this command to run this file. So you can
put "#!/usr/bin/fish-and-chips" as the first line and it will try to run
the file using /usr/bin/fish-and-chips.

If you put #!/usr/bin/python3.3 the shell will use the executable
/usr/bin/python3.3. It doesn't know or care about Python or its
versions: it won't go looking for some alternative binary. If
/usr/bin/python3.3 isn't there, the shell will fail to run the code with
some kind of error message.

If you or your package manager symlink /usr/bin/python3 to whatever the
latest Python 3.x is on your system then you can safely use
/usr/bin/python3 throughout and let the symlink do the work!

TJG

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web