New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python launcher invoked with command "py" fails to start process #99442
Comments
|
This error causes a failure to build MSI installer between version 3.7 and 3.10. (Example of GitHub Actions build failure in my personal project). This is because WiX invokes |
|
Confirmed, I am seeing the same issue (see the linked rust issue report above). |
|
In Lines 565 to 580 in 88385b8
A couple of issues in
|
… include a file extension (pythonGH-99542) (cherry picked from commit a220c6d) Co-authored-by: Steve Dower <steve.dower@python.org>
|
The fix appears to have addressed part of my issue, but I'm still getting the same error in a slightly different case. I haven't yet been able to reduce the test case to something smaller, but if I use the then running If I add some debugging prints, I can see that the command being run was |
|
Thanks for the quick extra test! This one looks like it's probably shebang parsing - can you include the whole output you get with PYLAUNCHER_DEBUG set? |
|
Oh, this is probably the deliberate change of behaviour to make shebang lines only search PATH if you use If it falls through to the default case, we don't let you search for arbitrary executables. It will only look adjacent to the script file. The old behaviour was never documented, and isn't safe (the new behaviour is only mildly safer, but at least you can scan for
|
|
|
It is, and I don't love it, but most other approaches for my use case have downsides. I will say that the old launcher went into a hard recursive loop on this, locking my machine with masses of processes. That's extremely bad, and avoiding that is definitely worthwhile. Obviously, from what I'm doing here, you can tell that I'd prefer and I run it as The reason I'm doing this at all is that I'm using The problem is that I don't want to hard-code a path for the interpreter in the shebang line, and the only way to run Python that's guaranteed to be on PATH is via I'm not even sure who I should be asking for help with this. In isolation, the behaviour of both |
|
The new launcher resolves Does Alternatively, does On a related note, the launcher supports user-defined commands such as "py" in the |
|
All of those are great ideas, thanks! I'll give them a try when I have some free time. Overall, it does seem a bit non-obvious to find something that works, which is a shame, but I don't think there's an easy resolution for that. Long-term, we should ideally have a unified way of running Python on all platforms, but I doubt that will happen soon... |
|
Actually, I had a few moments. Just's implementation of But using |
Actually, it appears that the fix for this issue has broken that case At this point, I'm frustrated by this whole thing. The new behaviour (treating the shebang as relative to the script location) is a change from the behaviour described in PEP 397:
which was (as far as I am aware) introduced without discussion, and which is not included in the "What's new in 3.11" documentation. If I'm wrong, please point me to the discussion of this new behaviour. It's quite possible that I would have approved the change if I'd been asked about it in advance, and I'm definitely not suggesting that the new behaviour is wrong as such - but I do think that we should have provided better support and information for people who might have been relying on the old behaviour. Now that this has already happened, I'm not sure what, if anything, should be done. My feeling is that an "after the fact" update to the what's new document, offering migration advice in the "Porting to 3.11" section for people who were using the old behaviour, is probably the best thing to do. But I'm open to other suggestions (although I'm not keen on "do nothing", as you might have guessed |
|
Yeah, there were certainly no updates made to the PEP, and we based the changes on what was in the documentation (worth noting that the PEP has a number of inconsistencies in this area, and is also dated with respect to what's considered secure practices). The discussion unfortunately seems to be in #98732, hidden under resolved comments (one of the reasons I always disliked the plan of moving everything to GitHub, but I didn't do this on purpose ;) ). FWIW, I found this by looking at NEWS for "launcher" and going to the one that was pretty clearly about changing the shebang handling. I still think it's highly defensible to drop the CWD search, but happy to argue about dropping the PATH search for unqualified names. There are already fixes coming in 3.11.1 to get closer to old behaviour, so no harm in bringing back more. Let's do it on a new issue though.
My sincere apologies for this. I know it's hard to keep up with all the changes going on in all the different places, but it's equally hard to know whose opinion ought to be sought on every issue. It's also frustrating for me to find that every change I make frustrates someone else for not being consulted (you're not the first), even if the change was accidental ;) , but I'm not sure what the solution is other than to stop contributing. |
kai2nenobu commentedNov 13, 2022
•
edited by bedevere-bot
Bug report
When I invoke a python launcher of version 3.11.0 with
"py"command, a python launcher fails to start process.Step to reproduce
Install python 3.11.0 with py launcher for all users.
Invoke
"py"in command prompt.I expect to launch a python interpreter, but got a error as below
Debug output when enable PYLAUNCHER_DEBUG
I think this error seems to be similar to #95285. If I invoke
pyor"py.exe", a python interpreter starts well as I expected.In version 3.10.8, all of
"py",pyand"py.exe"start a python interpreter correctly.Your environment
Linked PRs
The text was updated successfully, but these errors were encountered: