Re: Silly/crazy problem with sqlite
Am 24.11.2023 um 22:49 schrieb Rimu Atkinson via Python-list: I really can't think of a case where the missing comma would make any sense at all. That is pretty tricky, yes. The comma means it's a tuple. Without the comma, it's just a string with parenthesis around it, which is a string. Placeholders for the parameters in an SQL command for sqlite3.execute(..) must always be given as dict or sequence. Even if it's just one parameter. Same thing with other database modules, it's given in PEP 249. HTH Sibylle -- https://mail.python.org/mailman/listinfo/python-list
Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
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
Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
Am 22.12.2023 um 14:13 schrieb Barry:
On 22 Dec 2023, at 12:39, Sibylle Koczian via Python-list
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".
Thank you,
Sibylle
--
https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
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 -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
Am 01.01.2024 um 12:50 schrieb Barry via Python-list: On 1 Jan 2024, at 11:14, Sibylle Koczian via Python-list 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 uses shebang lines should be visible in the documentation. See my earlier reply with info on ftype etc output. What do you see on your windows 10 vs windows 11? Oh yes, I forgot to answer, here are my results: py -0: 1. Windows 10, Python 3.11.5: -V:3.11 *Python 3.11 (64-bit) -V:3.6 Python 3.6 (64-bit) possibly part of Visual Studio or else Calibre? 2. Windows 11, Python 3.12.1; -V:3.12 *Python 3.12 (64-bit) assoc .py 1. Windows 10, Python 3.11.5: .py=Python.File 2. Windows 11, Python 3.12.1: .py=Python.File ftype Python.File 1. Windows 10, Python 3.11.5: Python.File="C:\WINDOWS\py.exe" "%L" %* 2. Windows 11, Python 3.12.1: Python.file="C:\Windows\py.exe" "%L" %* Test Script test_shebang.py starts with one of these shebang lines: a) #! python b) #! /usr/bin/python c) #! /usr/bin/env python import sys print(sys.executable) Results: 1. Windows 10, Python 3.11.5: test_shebang.py, Version a): C:\Program Files\Python311\python.exe py test_shebang.py, Version a): C:\Program Files\Python311\python.exe test_shebang.py, Version b): C:\Program Files\Python311\python.exe py test_shebang.py, Version b): C:\Program Files\Python311\python.exe test_shebang.py, Version c): C:\Program Files\Python311\python.exe py test_shebang.py, Version c): C:\Program Files\Python311\python.exe 2. Windows 11, Python 3.12.1: test_shebang.py, Version a): C:\Program Files\Python312\python.exe py test_shebang.py, Version a): C:\Program Files\Python312\python.exe test_shebang.py, Version b): C:\Program Files\Python312\python.exe py test_shebang.py, Version b): C:\Program Files\Python312\python.exe test_shebang.py, Version c): Python konnte nicht gefunden werden. F³hren Sie die Verkn³pfung ohne Argumente aus, um sie ³ber den Microsoft Store zu installieren, oder deaktivieren Sie diese Verkn³pfung unter py test_shebang.py, Version c): Python konnte nicht gefunden werden. F³hren Sie die Verkn³pfung ohne Argumente aus, um sie ³ber den Microsoft Store zu installieren, oder deaktivieren Sie diese Verkn³pfung unter It's a german Windows version, first sentence: "Python could not be found". I don't really know how to translate the second sentence. 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. Thank you for helping, Sibylle -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
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 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? Thank you for helping, Sibylle -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
Am 15.01.2024 um 00:46 schrieb Mike Dewhirst via Python-list: In Windows the provided methods for running complex command lines are either a batch file or a shortcut.Someone very kindly pointed out to me in this thread that there is a PEP for py.exe. I don't use py.exe originally because I didn't trust it believing it was a new-fangled Microsoft trick. I did read that PEP but it has no relevance for my mixed Windows/Linux environments. On reflection I now believe I won't use py.exe because it introduces an unnecessary layer of indirection.The bottom line is that you still need to know which Python a particular set of circumstances demands and if you use py.exe you then need to also understand how it chooses and how it interprets shebang lines written for your Linux environment. And if that isn't your situation I have jumped to the wrong conclusion.I have found no problem in Windows when I use shebang lines in scripts intended for execution in both Linux and Windows. They are ignored unless you use py.exe.My advice is to give up py.exe unless your use case mandates shebang lines in Windows.M--(Unsigned mail from my phone) 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 \python 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??? Sibylle -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
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 -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
Am 16.01.2024 um 23:44 schrieb Barry via Python-list: On 16 Jan 2024, at 17:11, Sibylle Koczian via Python-list 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. Thank you! That did it. These two settings were off in the older Windows 10 installation and on in the new Windows 11. Changed there and the shebang lines with "/env" work as expected. I didn't remember ever seeing these settings on my "old" computer, but it seems I turned them off six years ago and completely forgot about them. Or could that have been an older default? "python" or "python3" in the shebang line doesn't seem to make a difference, at least not on machines that never saw Python 2. Very glad to know what was the matter here, Sibylle -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
Am 17.01.2024 um 19:44 schrieb Mats Wichmann via Python-list: 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. Yes. Python is not on the Path - by design. while the new Windows 11 machine finds the Microsoft stub. Not any more - see my reply to Barry. Thanks to all who answered! Sibylle -- https://mail.python.org/mailman/listinfo/python-list
