python / python/cpython

32-bit Python 3.12.7 subprocess.run() cannot run executables from Windows\System32

Abierto
#125,879 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

OS-windows type-bug
Lenguaje dominante
Python
Estrellas
77.2k
Forks
35.9k
Métricas de merge de PR
Métricas de PR pendientes

Descripción

Bug report

Bug description:
PS C:\> py -V:3.12-32 -c "import subprocess; subprocess.run(['ssh'])"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Brecht Machiels\AppData\Local\Programs\Python\Python312-32\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Brecht Machiels\AppData\Local\Programs\Python\Python312-32\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Brecht Machiels\AppData\Local\Programs\Python\Python312-32\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

This does work in the 64-bit Python 3.12.7 (after renaming vcruntime140.dll; see #125872):

PS C:\> py -V:3.12 -c "import subprocess; subprocess.run(['ssh'])"
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
           [-i identity_file] [-J [user@]host[:port]] [-L address]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] destination [command [argument ...]]

I'm assuming that this is because ssh.exe is an ARM executable. Using file in a Git Bash shell:

$ file "C:\Windows\System32\OpenSSH\ssh.exe"
C:\Windows\System32\OpenSSH\ssh.exe: PE32+ executable (console) Aarch64, for MS Windows, 6 sections

Calling an amd64 git does work:

PS C:\> py -V:3.12-32 -c "import subprocess; subprocess.run(['git', 'version'])"
git version 2.47.0.windows.1
$ file "C:\Program Files\Git\cmd\git.exe"
C:\Program Files\Git\cmd\git.exe: PE32+ executable (console) x86-64, for MS Windows, 13 sections
CPython versions tested on:

3.12

Operating systems tested on:

Windows 11 ARM

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el fallo con el comando de Python 3.12 de 32 bits en Windows 11 ARM y, después, inspeccione Lib/subprocess.py alrededor de Popen y _execute_child, especialmente la llamada a _winapi.CreateProcess. Compárelo con los casos correctos de 64 bits y amd64 Git; se considera terminado cuando subprocess.run(['ssh']) puede iniciar el ejecutable de Windows System32 en la configuración indicada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
operating-systems
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.