Skip to content

Calling 'py' from other languages calls invalid path to 'py' #99587

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

Closed
vlad-emelyanov opened this issue Nov 18, 2022 · 2 comments
Closed

Calling 'py' from other languages calls invalid path to 'py' #99587

vlad-emelyanov opened this issue Nov 18, 2022 · 2 comments
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

Comments

@vlad-emelyanov
Copy link

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:

  1. Install the Python 3.11.0 x64 Windows installer, including the Python launcher
  2. Run the following sample C# program

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

  • CPython versions tested on: 3.10.5, 3.11.0
  • Operating system and architecture: Window
@vlad-emelyanov vlad-emelyanov added the type-crash A hard crash of the interpreter, possibly with a core dump label Nov 18, 2022
@eryksun
Copy link
Contributor

eryksun commented Nov 18, 2022

This is a duplicate of #99442, a bug with handling a command line that starts with quoted "py".

@sobolevn sobolevn added the pending The issue will be closed if no feedback is provided label Nov 19, 2022
@kumaraditya303
Copy link
Contributor

Duplicate of #99442

@kumaraditya303 kumaraditya303 marked this as a duplicate of #99442 Dec 31, 2022
@kumaraditya303 kumaraditya303 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

5 participants