Calling 'py' from other languages calls invalid path to 'py' #99587
Labels
OS-windows
pending
The issue will be closed if no feedback is provided
type-crash
A hard crash of the interpreter, possibly with a core dump
Crash report
The Python Launcher (version 3.11.7966.0) that comes with Python 3.11.0 crashes because it resolves 'py' to a path that doesn't exist (C:\Users{USERNAME}\AppData\Local\Programs\Python\Python311\py) when launched as a subprocess from another programming language (tested in C# and Rust). It appears to look for py.exe in the installation location of python.exe, however 'py.exe' is not present there. The below error is thrown even if Python 3.11.0 is uninstalled (leaving only Python 3.10.5) but the 3.11 launcher is still present. This error does not get thrown by the 3.10 or earlier launcher (even if Python 3.11 is installed). This is 10/10 reproducible on every Windows machine we've tested on. This is not reproducible by calling 'py' directly on the command line, or with a Python 'subprocess.Popen()' call.
Reproduction steps:
using System.Diagnostics;
namespace TestApp {
class Program {
static void Main(string[] args) {
var p = new Process {
StartInfo = {
FileName = "py",
ArgumentList = { "--version" },
}
};
p.Start();
p.WaitForExit();
}
}
}
Error messages
Unable to create process using 'C:\Users\vemelyanov\AppData\Local\Programs\Python\Python311\py" --version': The system cannot find the file specified.
This error seems to come from the launcher itself, not the executing program (i.e. C# or Rust). If the C# program above calls a command that actually doesn't exist on the system, it will throw a 'System.ComponentModel.Win32Exception (2): The system cannot find the file specified.' instead of logging the above message.
Your environment
The text was updated successfully, but these errors were encountered: