Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

The Wright Bothers weren't the first to fly. They were just the first not to crash.


devel / comp.lang.python / Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

SubjectAuthor
o Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work Mats Wichmann

1
Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

<mailman.65.1705343186.15798.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24873&group=comp.lang.python#24873

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: mat...@wichmann.us (Mats Wichmann)
Newsgroups: comp.lang.python
Subject: Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3
doesn't work any more
Date: Mon, 15 Jan 2024 11:26:16 -0700
Lines: 45
Message-ID: <mailman.65.1705343186.15798.python-list@python.org>
References: <8dcf3464-e32f-457b-8938-0ff013ed4262@web.de>
<4TCsVz4CzPznVGL@mail.python.org>
<f63eac91-be2b-4e13-823f-1b99a43b709d@web.de>
<b9235356-db47-49fd-b14f-8e9d9fa20149@wichmann.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de Q6aPywPjoLMiGIAn4ulc6Qtl2RHOqqfnavhigQtSl+pQ==
Cancel-Lock: sha1:vwQiQVA8OUzxJ73Z1IIP6j4c6Po= sha256:79UOLaPl+GeQklymtjr0xp7u9eHN7cfyKD0tEib0zg0=
Return-Path: <mats@wichmann.us>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="1024-bit key; unprotected key"
header.d=pobox.com header.i=@pobox.com header.b=fzdB99rO;
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'looks': 0.02; 'this:':
0.03; 'knows': 0.04; 'entering': 0.05; 'fairly': 0.05;
'searching': 0.05; 'subject:Windows': 0.07; 'console,': 0.09;
"shouldn't": 0.09; 'solution,': 0.09; 'subject:Python': 0.12;
'received:173': 0.13; 'that.': 0.15; 'default.': 0.16; 'machine,':
0.16; 'prompts': 0.16; 'python3': 0.16; 'something.': 0.16;
'subject:usr': 0.16; 'wrote:': 0.16; 'python': 0.16; 'probably':
0.17; 'to:addr:python-list': 0.20; 'machine': 0.22; "i've": 0.22;
'first,': 0.22; 'maybe': 0.22; 'version': 0.23; 'install': 0.23;
'command': 0.23; 'installed': 0.23; 'lines': 0.23; 'tried': 0.26;
'computer': 0.29; 'header:User-Agent:1': 0.30; 'default': 0.31;
'think': 0.32; "doesn't": 0.32; 'python-list': 0.32; 'but': 0.32;
"i'm": 0.33; 'there': 0.33; 'particular': 0.33; 'path': 0.33;
'script': 0.33; 'windows': 0.34; 'someone': 0.34; 'same': 0.34;
'header:In-Reply-To:1': 0.34; 'computer.': 0.35; 'really': 0.37;
'using': 0.37; "it's": 0.37; 'received:192.168': 0.37; 'could':
0.38; 'put': 0.38; 'changes': 0.39; 'copies': 0.39; 'use': 0.39;
'seeing': 0.39; 'base': 0.40; "couldn't": 0.40; 'double': 0.40;
'want': 0.40; 'here': 0.62; 'down': 0.64; 'your': 0.64; 'box':
0.65; 'years': 0.65; 'worked': 0.67; 'older': 0.70; 'virtual':
0.71; 'little': 0.73; "you'll": 0.73; 'clicking': 0.76; 'itself.':
0.84; 'store.': 0.84; 'subject: \n ': 0.84; 'subject:bin': 0.84;
'magic': 0.93; 'fall': 0.95; 'subject:more': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=message-id
:date:mime-version:subject:to:references:from:in-reply-to
:content-type:content-transfer-encoding; s=sasl; bh=xrHJ+0UTZNs/
rSKI/VnTygfdSP3ZV+GIX0Jete5+1co=; b=fzdB99rOymYVqsc2U2nwnz+Pw9L5
UfwHFX3U6Hp7nSjQf03RVYvrGqdGcSSKLjO5xQy63URvCNKwRQA38ed3TAepTJ+I
SCv+ZXvbcqkVHJEBjqbVfAbnpsoPeWQ3f+PCLaJfEKwpgAy5hjD1Z7GyXYvbZuxP
DCFcyL7W04fGyyA=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=wichmann.us;
h=message-id:date:mime-version:subject:to:references:from:in-reply-to:content-type:content-transfer-encoding;
s=2018-07.pbsmtp; bh=xrHJ+0UTZNs/rSKI/VnTygfdSP3ZV+GIX0Jete5+1co=;
b=PV8VsQva3BTOAoHWPgfNVTIVBFjFPKKp6nFZ1XN5tCoPz6TkbwfYQ7u8+iFLkRGHrEN4UK5eMDQNtltIfH0fpBxnzT79m3xsV6cTs4grgfOmGdU4mHRBEwY3f0ChoczWlT/mj5bFO4BhzQG61S5ix+A1A08Uhk5tEEwPNNUbt8M=
User-Agent: Mozilla Thunderbird
Content-Language: en-US
Autocrypt: addr=mats@wichmann.us; keydata=
xsDiBD9xp6oRBAC1vd3YI8Gcr1CxpV1gldNQu0uQsNaICDk+Ai3+R163s/P83JOYG+SBEA3P
v7iZx70qpQ3RzP7KrjF1Nm6j0em9ccUX2fPQUCAxXw5Hiq7CSMiwQQZRI6shcnyMh9XTKViT
WK5MrKDyvjDEn7epjKzKwPS5SG039l6XaOKU0A4uGwCgsNqUQqC0gMMcbKlJV8ql58iKmbMD
/ii8FPQrXmyS/FnsPs7UddV5qMHKm7NUH5oiKuMVyakInRyq9iIxuu3D4Ec6mWRKcGsjmIkW
HXCSz0aefs6dsqNqpU54cYioJ3wP5LzHK7oclgJPryVt5Qezbdutf8SQf8gVkaNIlkxwGUzi
bKTZ6CHzwlz9nNgeel0XPUcZzFxGA/4paeCg2rMSVuAhUQbsLYHu4XzTs9P16zaXkrtxc4m5
b+BF5xsLgTpyO5l859XudS2Gp+7/Y37dAU4QlyGGOboWmF1y9U5DnzBwG8ghsnym+ga58MJh
LdRdQQ6xQolCpEXOuzm40f2r5uMxF3KOJ7WpIPuGAkeCPru9BmlATH+zOs0gTWF0cyBXaWNo
bWFubiA8bWF0c0B3aWNobWFubi51cz7CYQQTEQIAIQIbAwYLCQgHAwIDFQIDAxYCAQIeAQIX
gAUCT0VyZwIZAQAKCRDAMaCQc9hUxiZBAJ9cWziGp7hVfsu5T+cQptc3rLNndQCgrZh8u5LW
BfJ5e/Y+3PwZ8UEm+ELOwE0EP5is8BAEAMtwzcA8TYf5UTjDMgwcSNoErTc9ag+IX05QFgL8
aF8sfJRv5atcitqQy0gSIsOzI+L/AFdPN/+QQI3dL1tCq14t32KPDtigDhzm6jVPXX5z+V9u
xnD8XTp+ZvNcWoHXjViM8aXeLLEiCpiVCho307h3XShvqoKINWRQWeAsKKDDAAMFA/48zaey
wiiEyvI0meJ1KkNHxdLP0yLODr1WV6j9xkPkLWOaIDw7dlwEOlF1N1YtZ2wa0p1wsttdIbIx
ffgwXmcH4zrdxUIMz3U0BqYzk5H+5cYFXECXTFVOmweS+JECYMj80PjRoKCO1eVO1N30zksB
36NnhZWPRWIhjK3ZarIYH8JGBBgRAgAGBQI/mKzwAAoJEMAxoJBz2FTG6VEAoKDYHfDp5Q3q
PuPvPahCE9HsXMgAAJ9INTqcLSJrOfyJ8q95nBO1T26H2Q==
In-Reply-To: <f63eac91-be2b-4e13-823f-1b99a43b709d@web.de>
X-Pobox-Relay-ID: 938AE232-B3D3-11EE-A571-F515D2CDFF5E-81526775!pb-smtp20.pobox.com
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <b9235356-db47-49fd-b14f-8e9d9fa20149@wichmann.us>
X-Mailman-Original-References: <8dcf3464-e32f-457b-8938-0ff013ed4262@web.de>
<4TCsVz4CzPznVGL@mail.python.org>
<f63eac91-be2b-4e13-823f-1b99a43b709d@web.de>
 by: Mats Wichmann - Mon, 15 Jan 2024 18:26 UTC

On 1/15/24 09:44, Sibylle Koczian via Python-list wrote:

> First and foremost I want to understand why I'm seeing this:
>
> - Python scripts with "/usr/bin/env python3" as shebang line work as
> expected on a computer with Windows 10 and Python 3.11.5. They have
> worked for years on this machine, using either the latest Python or one
> version before (depending on availability of some packages). There is a
> virtual machine with ArchLinux on the same machine and some of the
> scripts are copies from that.
>
> - I've got a second computer with Windows 11 and I installed Python
> 3.12.1 on it. After copying some scripts from my first computer I found
> that I couldn't start them: not by entering the script name in a
> console, not using py.exe, not double clicking in the explorer. Entering
> <full_path_to_python.exe>\python <scriptname> probably worked - I think
> I tried that too, but I'm not really sure, because that's really not
> practical.
>
> In the Python documentation for versions 3.11 and 3.12 I found no
> differences regarding py.exe and shebang lines.
>
> Then I removed the "/env" from the shebang lines and could start the
> scripts from the second computer. That certainly is a solution, but why???

It's because of Windows itself. The default nowadays is that irritating
little stub that prompts you to go install Python from the WIndows
store. When you use the "env" form, it looks for python (or python3 in
your case) in the PATH *first* and you'll get a hit. Mine looks like:

C:\Users\mats\AppData\Local\Microsoft\WindwsApps\python.exe and python3.exe

you can check what it's doing for you by using the "where" command in a
windows shell.

On your older Windows 10 machine you either never had that stub - I
don't know when it was added, maybe someone from Microsoft listening
here knows - or it's been superseded by changes to the PATH, or
something. On my fairly new Win 11 box the base of that path is early
in the user portion of PATH, so that must be a default.

py.exe without the "/usr/bin/env" magic doesn't put PATH searching
first, according to that snip from the docs that's been posted here
several times., so you shouldn't fall down that particular rathole.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor