On 22 Dec 2023, at 12:39, Sibylle Koczian via Python-list <python-list@python.org> wrote:
Hello,
I always install Python on Windows in the same manner:
- Python is not on the path,
- it is installed for all users,
- the Python Launcher is installed for all users,
- the file types .py, .pyw etc. are associated with Python.
My shebang line is usually "#!/usr/bin/env python3".
This has always worked well. I could run Python scripts in a console
window entering just the script name, by double clicking in the explorer
or using WIN+r; the two last variants for GUI or for scripts with
something like "input('Leave with Enter')" at the end.
Now I've got a new computer with Windows 11 and I've installed Python
3.12.1. On my older machine it's Windows 10 and Python 3.11.5. Reading
the Python documentation it seems my shebang lines should work as before
- but they don't. The error message:
"Unable to create process using 'C:\usr\bin\env\python "C:\Eigen\Src\launcher_versuche.py" ': Das System kann die angegebene
Datei nicht finden."
Without the "env" in the shebang line and only without it everything
works as expected - but that's contrary to the documentation, isn't it?
Thank you for information,
Sibylle
--
https://mail.python.org/mailman/listinfo/python-list
Hello,
I always install Python on Windows in the same manner:
- Python is not on the path,
- it is installed for all users,
- the Python Launcher is installed for all users,
- the file types .py, .pyw etc. are associated with Python.
My shebang line is usually "#!/usr/bin/env python3".
On 22 Dec 2023, at 12:39, Sibylle Koczian via Python-list <python-list@python.org> wrote:
Hello,
I always install Python on Windows in the same manner:
- Python is not on the path,
- it is installed for all users,
- the Python Launcher is installed for all users,
- the file types .py, .pyw etc. are associated with Python.
My shebang line is usually "#!/usr/bin/env python3".
This has always worked well. I could run Python scripts in a console
window entering just the script name, by double clicking in the explorer
or using WIN+r; the two last variants for GUI or for scripts with
something like "input('Leave with Enter')" at the end.
Now I've got a new computer with Windows 11 and I've installed Python
3.12.1. On my older machine it's Windows 10 and Python 3.11.5. Reading
the Python documentation it seems my shebang lines should work as before
- but they don't. The error message:
"Unable to create process using 'C:\usr\bin\env\python
"C:\Eigen\Src\launcher_versuche.py" ': Das System kann die angegebene
Datei nicht finden."
Without the "env" in the shebang line and only without it everything
works as expected - but that's contrary to the documentation, isn't it?
This suggests a typo in the shebang line. Is there a space between env and python?
Barry
On 22 Dec 2023, at 14:58, Christian Buhtz via Python-list <python-list@python.org> wrote:
On Windows 11 it usually is the "Terminal" which is different from cmd.exe.
On 22 Dec 2023, at 14:29, Sibylle Koczian <nulla.epistola@web.de> wrote:
#!/usr/bin/env/python
Hello,
I always install Python on Windows in the same manner:
- Python is not on the path,
- it is installed for all users,
- the Python Launcher is installed for all users,
- the file types .py, .pyw etc. are associated with Python.
My shebang line is usually "#!/usr/bin/env python3".
This has always worked well. I could run Python scripts in a console
window entering just the script name, by double clicking in the explorer
or using WIN+r; the two last variants for GUI or for scripts with
something like "input('Leave with Enter')" at the end.
Now I've got a new computer with Windows 11 and I've installed Python
3.12.1. On my older machine it's Windows 10 and Python 3.11.5. Reading
the Python documentation it seems my shebang lines should work as before
- but they don't. The error message:
"Unable to create process using 'C:\usr\bin\env\python "C:\Eigen\Src\launcher_versuche.py" ': Das System kann die angegebene
Datei nicht finden."
Without the "env" in the shebang line and only without it everything
works as expected - but that's contrary to the documentation, isn't it?
Am 22.12.2023 um 14:13 schrieb Barry:
On 22 Dec 2023, at 12:39, Sibylle Koczian via Python-list
<python-list@python.org> wrote:
Hello,
I always install Python on Windows in the same manner:
- Python is not on the path,
- it is installed for all users,
- the Python Launcher is installed for all users,
- the file types .py, .pyw etc. are associated with Python.
My shebang line is usually "#!/usr/bin/env python3".
This has always worked well. I could run Python scripts in a console
window entering just the script name, by double clicking in the explorer >>> or using WIN+r; the two last variants for GUI or for scripts with
something like "input('Leave with Enter')" at the end.
Now I've got a new computer with Windows 11 and I've installed Python
3.12.1. On my older machine it's Windows 10 and Python 3.11.5. Reading
the Python documentation it seems my shebang lines should work as before >>> - but they don't. The error message:
"Unable to create process using 'C:\usr\bin\env\python
"C:\Eigen\Src\launcher_versuche.py" ': Das System kann die angegebene
Datei nicht finden."
Without the "env" in the shebang line and only without it everything
works as expected - but that's contrary to the documentation, isn't it?
This suggests a typo in the shebang line. Is there a space between env
and python?
Barry
Tried several variants with the same script:
#!/usr/bin/env python3
# That's how I wrote it for Windows 10 / Python 3.11. It works there.
#!/usr/bin/env python
#!/usr/bin/env/python
The error messages vary a little. This is a German Windows installation,
the two variants with the space produce the same German error message,
the third produces the message I've put into my first description.
The working variant on Windows 11 / Python 3.12 is "#!/usr/bin python".
On 23 Dec 2023, at 00:15, Thomas Passin via Python-list <python-list@python.org> wrote:
In neither case is the shebang line used.
On 23 Dec 2023, at 00:15, Thomas Passin via Python-list <python-list@python.org> wrote:
In neither case is the shebang line used.
As i understand it, not in front of my windows box to check.
The handler for .py file extension is set to be the py.exe
It is py.exe that understands shebang lines.
Using the py launcher as your Windows association with .py and.pyw files
you can have multiple versions of python installed and everything works
as it should, according to your shebang, just like on Unix.
On 12/22/23 07:02, Thomas Passin via Python-list wrote:
On my Windows 10 machine, Python scripts run without a shebang line.
Perhaps Windows 11 has added the ability to use one, but then you would
need to use the actual location of your Python executable.
Yes if you associate .py or .pyw with python.exe (or pythonw.exe), then things work as you describe. However it's no longer recommended to do
that.
Instead---and I think this is the default now when you install
python---you should associate both .py and .pyw files with the py
launcher (py.exe) and it will examine the shebang line of the script and determine which version of python to run. As I said this should work regardless of the path listed in the shebang. Note that the shebang is meaningless to Windows itself, and Windows Explorer. It is only
meaningful to the py launcher. So it's customary to just use a
unix-style shebang in your python scripts. So either #!/usr/bin/python3
or #!/usr/bin/env python3 as you would in unix.
Using the py launcher as your Windows association with .py and.pyw files
you can have multiple versions of python installed and everything works
as it should, according to your shebang, just like on Unix.
In my experience one should always make sure to know what version of Python is being used, at least if there is more than one version installed on the computer. Even on Linux using a shebang line can be tricky, because you are likely to get the system's version of Python,
and that often is not what you want. OTOH you don't want to go
symlinking python3 to some other version of python because then the OS
system may not work right. So either you have to specify the Python
version in the shebang,
or just specify the right version
on the command line. In that case you might as well not have included the shebang line at all.
On 23 Dec 2023, at 03:01, Thomas Passin via Python-list <python-list@python.org> wrote:to run Python files.
Not on my system. It may depend on whether Python gets installed to Program Files or to %USERPROFILE%/AppData/Local/Programs/Python. Python 3.9 is the last verson I installed to Program Files, and that's the version that Windows thinks it should use
Run the little test program I posted. That will tell you which version of Python the system wants to use.
On 24 Dec 2023, at 00:54, rbowman via Python-list <python-list@python.org> wrote:
Does that work with virtualenv or conda? I'm slowly getting up to speed
with those.
On 24 Dec 2023, at 00:54, rbowman via Python-list
<python-list@python.org> wrote:
Does that work with virtualenv or conda? I'm slowly getting up to speed
with those.
Conda is its own thing, not need for py.exe.
Once you have created the venv you do not need py.exe as you will have pythob.exe in the venv bin folder.
I had assumed the OP had installed Python from the Microsoft shop and
that's where py.exe must have come from.
On 1 Jan 2024, at 11:14, Sibylle Koczian via Python-list <python-list@python.org> wrote:uses shebang lines should be visible in the documentation.
But in all this thread I didn't see a single explanation for my current situation: one and the same shebang line works on Windows 10 / Python 3.11 and doesn't work on Windows 11 / Python 3.12. I suspect Windows, because a change in the way Python 3.12
Am 30.12.2023 um 04:04 schrieb Mike Dewhirst via Python-list:
I had assumed the OP had installed Python from the Microsoft shop and
that's where py.exe must have come from.
In fact I didn't say in my post that I always get Python from
python.org. When I started to use the language there was no Python from
any Microsoft shop (I'm not sure there was a Microsoft shop, it was in
the last millenium, Python 1.5 or 1.6). So I tend to forget that
possible download source.
But in all this thread I didn't see a single explanation for my current situation: one and the same shebang line works on Windows 10 / Python
3.11 and doesn't work on Windows 11 / Python 3.12. I suspect Windows,
because a change in the way Python 3.12 uses shebang lines should be
visible in the documentation.
Happy new year to all!
Sibylle
Am 30.12.2023 um 04:04 schrieb Mike Dewhirst via Python-list:
I had assumed the OP had installed Python from the Microsoft shop and
that's where py.exe must have come from.
In fact I didn't say in my post that I always get Python from
python.org. When I started to use the language there was no Python from
any Microsoft shop (I'm not sure there was a Microsoft shop, it was in
the last millenium, Python 1.5 or 1.6). So I tend to forget that
possible download source.
But in all this thread I didn't see a single explanation for my current situation: one and the same shebang line works on Windows 10 / Python
3.11 and doesn't work on Windows 11 / Python 3.12. I suspect Windows,
because a change in the way Python 3.12 uses shebang lines should be
visible in the documentation.
My shebang line is usually "#!/usr/bin/env python3"
^Z
On 1/1/2024 6:02 AM, Sibylle Koczian via Python-list wrote:
Am 30.12.2023 um 04:04 schrieb Mike Dewhirst via Python-list:
I had assumed the OP had installed Python from the Microsoft shop and
that's where py.exe must have come from.
In fact I didn't say in my post that I always get Python from
python.org. When I started to use the language there was no Python
from any Microsoft shop (I'm not sure there was a Microsoft shop, it
was in the last millenium, Python 1.5 or 1.6). So I tend to forget
that possible download source.
But in all this thread I didn't see a single explanation for my
current situation: one and the same shebang line works on Windows 10 /
Python 3.11 and doesn't work on Windows 11 / Python 3.12. I suspect
Windows, because a change in the way Python 3.12 uses shebang lines
should be visible in the documentation.
Happy new year to all!
Sibylle
Happy New Year!
I speculated that the shebang line didn't work on Windows 10 either, but
you didn't realize it because the file associations were right to launch ".py" programs with the right version of Python. When the newer version
of Python got installed, the default Python program to use, was not
updated correctly, and the shebang line still has nothing to do with the launch failure. This could happen if other the older install went into Program Files, while the newer one went into %USERPROFILE%\AppData\Local\Programs\Python.
This was backed up with all of 5 minutes of experimenting on my own
computer, on which Windows launches ".py" programs with an old install
of Python 3.9.9, but the py launcher launches Python 3.12 by default.
Since I am avoiding Windows 11, I can't try anything on it, so my
thoughts above may not be relevant.
The Python docs for 3.12.1 cover shebang lines at
https://docs.python.org/3/using/windows.html
"If the first line of a script file starts with #!, it is known as a “shebang” line. Linux and other Unix like operating systems have native support for such lines and they are commonly used on such systems to
indicate how a script should be executed. This launcher allows the same facilities to be used with Python scripts on Windows and the examples
above demonstrate their use.
To allow shebang lines in Python scripts to be portable between Unix and Windows, this launcher supports a number of ‘virtual’ commands to
specify which interpreter to use. The supported virtual commands are:
/usr/bin/env
/usr/bin/python
/usr/local/bin/python
python
For example, if the first line of your script starts with
#! /usr/bin/python
The default Python will be located and used. As many Python scripts
written to work on Unix will already have this line, you should find
these scripts can be used by the launcher without modification. If you
are writing a new script on Windows which you hope will be useful on
Unix, you should use one of the shebang lines starting with /usr."
But
"The /usr/bin/env form of shebang line has one further special property. Before looking for installed Python interpreters, this form will search
the executable PATH for a Python executable matching the name provided
as the first argument. This corresponds to the behaviour of the Unix env program, which performs a PATH search. If an executable matching the
first argument after the env command cannot be found, but the argument
starts with python, it will be handled as described for the other
virtual commands. The environment variable PYLAUNCHER_NO_SEARCH_PATH may
be set (to any value) to skip this search of PATH.
Shebang lines that do not match any of these patterns are looked up in
the [commands] section of the launcher’s .INI file. This may be used to handle certain commands in a way that makes sense for your system. The
name of the command must be a single argument (no spaces in the shebang executable), and the value substituted is the full path to the
executable (additional arguments specified in the .INI will be quoted as
part of the filename)."
Here's how to find out what program Windows thinks it should use to run
a ".py" file. In a console:
C:\Users\tom>assoc .py
.py=Python.File
C:\Users\tom>ftype Python.file
Python.file="C:\Windows\py.exe" "%L" %*
The only way to determine the association without reimplmenting theshell's search is to simply ask the shell via AssocQueryString. Possibly PowerShell can provide this information. – Eryk Sun
On 1/1/24 07:11, Thomas Passin via Python-list wrote:
Here's how to find out what program Windows thinks it should use to
run a ".py" file. In a console:
C:\Users\tom>assoc .py
.py=Python.File
C:\Users\tom>ftype Python.file
Python.file="C:\Windows\py.exe" "%L" %*
That's not enough. There is now (has been for a while) a layered system,
and this gives you just one layer, there may be other associations that
win out.
Per somebody who actually knows:
The only way to determine the association without reimplmenting theshell's search is to simply ask the shell via AssocQueryString. Possibly PowerShell can provide this information. – Eryk Sun
On Windows 10, a shebang line gets ignored in favor of Python 3.9.9 (if invoked by the script name alone) or Python 3.12.1 (if invoked by the
"py" launcher).
On 1/1/24 12:53, Thomas Passin via Python-list wrote:
On Windows 10, a shebang line gets ignored in favor of Python 3.9.9
(if invoked by the script name alone) or Python 3.12.1 (if invoked by
the "py" launcher).
fwiw, you can also create an ini file to define to the launcher py which version should be the default, if no version is specified.
On 2 Jan 2024, at 17:24, Thomas Passin via Python-list <python-list@python.org> wrote:Of course this situation isn't unique to py.exe!
You might learn about this if you happen to read and remember the right part of the Python docs. Otherwise you have no idea what py.exe is up to nor how it does it. I would say that most people don't know there's an ini file, let alone what it can do.
uses shebang lines should be visible in the documentation.On 1 Jan 2024, at 11:14, Sibylle Koczian via Python-list <python-list@python.org> wrote:
But in all this thread I didn't see a single explanation for my current situation: one and the same shebang line works on Windows 10 / Python 3.11 and doesn't work on Windows 11 / Python 3.12. I suspect Windows, because a change in the way Python 3.12
See my earlier reply with info on ftype etc output.
What do you see on your windows 10 vs windows 11?
On 7 Jan 2024, at 15:09, Sibylle Koczian via Python-list <python-list@python.org> wrote:
Oh, and the two Windows and Python versions are on two different computers.
Will remove the "/env" from my shebang lines, even if I don't understand what's happening.
On 7 Jan 2024, at 15:09, Sibylle Koczian via Python-list <python-list@python.org> wrote:
Oh, and the two Windows and Python versions are on two different computers. >>
Will remove the "/env" from my shebang lines, even if I don't understand what's happening.
Thanks for the details.
Only thing I can think of is that "python" may be defaulting to mean python 2.
If you use "#!/usr/bin/env python3" it may work on both.
Did you creates a py.ini file to configure py.exe?
See if you have %userappdata%\py.ini on either windows 10 or windows 11.
If so what is its contents?
I've tried with and without a py.ini and cannot duplicate what you see.
Am 09.01.2024 um 12:36 schrieb Barry Scott via Python-list:
On 7 Jan 2024, at 15:09, Sibylle Koczian via Python-list
<python-list@python.org> wrote:
Oh, and the two Windows and Python versions are on two different
computers.
Will remove the "/env" from my shebang lines, even if I don't
understand what's happening.
Thanks for the details.
Only thing I can think of is that "python" may be defaulting to mean
python 2.
If you use "#!/usr/bin/env python3" it may work on both.
No, it doesn't. That's the form I started with. When it didn't work I
thought "python3" might be too old, because Python 2 is dead for so long.
Did you creates a py.ini file to configure py.exe?
See if you have %userappdata%\py.ini on either windows 10 or windows 11.
If so what is its contents?
No to both.
I've tried with and without a py.ini and cannot duplicate what you see.
It really seems strange. Only thing I can think of - and I don't really believe in that idea: as far as I know in Windows 11 the handling of
PATH has changed. My Python isn't on the path, perhaps that is it. A
shebang line without "/env" doesn't check the path, right?
On 1/14/2024 7:48 AM, Sibylle Koczian via Python-list wrote:
Am 09.01.2024 um 12:36 schrieb Barry Scott via Python-list:
On 7 Jan 2024, at 15:09, Sibylle Koczian via Python-list
<python-list@python.org> wrote:
Oh, and the two Windows and Python versions are on two different
computers.
Will remove the "/env" from my shebang lines, even if I don't
understand what's happening.
Thanks for the details.
Only thing I can think of is that "python" may be defaulting to mean
python 2.
If you use "#!/usr/bin/env python3" it may work on both.
No, it doesn't. That's the form I started with. When it didn't work I
thought "python3" might be too old, because Python 2 is dead for so long. >>>
Did you creates a py.ini file to configure py.exe?
See if you have %userappdata%\py.ini on either windows 10 or windows 11. >>> If so what is its contents?
No to both.
I've tried with and without a py.ini and cannot duplicate what you see.
It really seems strange. Only thing I can think of - and I don't
really believe in that idea: as far as I know in Windows 11 the
handling of PATH has changed. My Python isn't on the path, perhaps
that is it. A shebang line without "/env" doesn't check the path, right?
From what I've read recently, if you have a Python program that starts
with a shebang line with any of four standard unix-like paths, then
Python (not Windows) will look for a version of Python in standard
locations - *NOT* in the shebang line locations:
"To allow shebang lines in Python scripts to be portable between Unix
and Windows, this launcher supports a number of ‘virtual’ commands to specify which interpreter to use. The supported virtual commands are:
/usr/bin/env
/usr/bin/python
/usr/local/bin/python
python
"
Also -
"The /usr/bin/env form of shebang line has one further special property. Before looking for installed Python interpreters, this form will search
the executable PATH for a Python executable matching the name provided
as the first argument. This corresponds to the behaviour of the Unix env program, which performs a PATH search. If an executable matching the
first argument after the env command cannot be found, but the argument
starts with python, it will be handled as described for the other
virtual commands.
"
There are some other complications, too, depending on whether you
specify bare "python" or some specific version. The form with
"/usr/bin/env" is the closest to the unix behavior, in that it searches
the PATH. And you write that your intended version of Python is not on
the path.
IOW, these shebang lines don't work the way you seem to think that they do.
See https://docs.python.org/3/using/windows.html for a more complete
rundown.
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???
Sibylle
The environment variable PYLAUNCHER_NO_SEARCH_PATH may be set (to anyvalue) to skip this search of PATH.
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???
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.
On 1/15/2024 1:26 PM, Mats Wichmann via Python-list wrote:
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.
Python from the App Store is not the same as Python from python.org:
Windows
natively has something called python.exe and python3.exe which is
interfering here
On 16/01/24 11:55 am, Mats Wichmann wrote:
Windows natively has something called python.exe and python3.exe which
is interfering here
I'm wondering whether py.exe should be taught to recognise these stubs
and ignore them. This sounds like something that could trip a lot of
people up.
On 1/15/2024 6:27 PM, Greg Ewing via Python-list wrote:
On 16/01/24 11:55 am, Mats Wichmann wrote:
Windows natively has something called python.exe and python3.exe
which is interfering here
I'm wondering whether py.exe should be taught to recognise these stubs
and ignore them. This sounds like something that could trip a lot of
people up.
There are registry entries that say where all the python.org install locations are. I suppose, but don't know, that py.exe checks them. The registry entries are
in Computer\HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore
On 1/15/24 12:01, Thomas Passin via Python-list wrote:
On 1/15/2024 1:26 PM, Mats Wichmann via Python-list wrote:
Python from the App Store is not the same as Python from python.org:
yes. this question is about the python.org distribution. but, Windows natively has something called python.exe and python3.exe which is
interfering here, IF the python.org install isn't directed to put itself
into the path, AND if the "#!/usr/bin/env python3" form is used, causing
a search in PATH, which is the setup Sibylle has described, unless I've misunderstood details.
On 16 Jan 2024, at 17:11, Sibylle Koczian via Python-list <python-list@python.org> wrote:
while the new Windows 11 machine finds the Microsoft stub
Am 15.01.2024 um 23:55 schrieb Mats Wichmann via Python-list:
On 1/15/24 12:01, Thomas Passin via Python-list wrote:
On 1/15/2024 1:26 PM, Mats Wichmann via Python-list wrote:
Python from the App Store is not the same as Python from python.org:
yes. this question is about the python.org distribution. but, Windows
natively has something called python.exe and python3.exe which is
interfering here, IF the python.org install isn't directed to put
itself into the path, AND if the "#!/usr/bin/env python3" form is
used, causing a search in PATH, which is the setup Sibylle has
described, unless I've misunderstood details.
No, you didn't misunderstand any detail. It's exactly right. My Windows
10 box doesn't find anything for "where python", "where python3",
while the new Windows 11 machine finds the Microsoft stub. "Irritating" is a very friendly attribute for that thing. Why must it be called
"python.exe" and not something else like the installation files from python.org?
I'll stop using "/env" - hopefully that won't create problems with the scripts I use in the Linux VM. But in that case I'll know what's up.
Thank you very much!
Sibylle
Be interesting to know if your WIndows 10 has those files in place, and
it's just a missing path entry (a good thing, perhaps) that's causing it
not to be found there.
while the new Windows 11 machine finds the Microsoft stub.
On 16 Jan 2024, at 17:11, Sibylle Koczian via Python-list <python-list@python.org> wrote:
while the new Windows 11 machine finds the Microsoft stub
You can turn off the stub in windows settings. The magic windows jargon is “App Execution Aliases”. Once you find it in settings you can turn off the python and python3 aliases.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 59:37:41 |
Calls: | 6,712 |
Files: | 12,243 |
Messages: | 5,355,695 |