3.11 Regression, Py_Initialize; Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding

Abierto
#99,004 7 comentarios 2 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

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

Línea de trabajo

Comienza con el programa en C que usa Py_Initialize y Python.h, reproduciendo el comportamiento en Windows 11 con Python 3.11. Compara la ejecución con la python311.dll instalada, una DLL copiada y versiones anteriores de Python; después, investiga cómo la inicialización localiza Lib/encodings. Se considera terminado cuando la DLL copiada de Python 3.11 puede inicializarse sin copiar por separado el directorio encodings.

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

Descripción

3.11 OS-windows type-bug

Bug report

Build and run the following program;

  #include <Python.h>
  
  int main(int argc, char* argv[])
  {
    Py_Initialize();
    return 0;
  }

The resulting executable runs fine when executed against the installed C:\Program Files\Python311\python311.dll

Executing against python311.dll copied to some other folder (C:\Windows\System32 for instance) results in;

Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x0000333c (most recent call first):
  <no Python frame>

When also C:\Program Files\Python311\Lib\encodings is copied then the executable runs fine again.

This is not the case with Python versions prior to 3.11. The only thing needed to run Python embedded for versions below 3.11 is the appropriate pythonXXX.dll

Your environment

  • CPython versions tested on:
    Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
  • Operating system and architecture:
    Edition Windows 11 Pro
    Version 21H2
    Installed on ‎11/‎24/‎2021
    OS build 22000.1098
    Experience Windows Feature Experience Pack 1000.22000.1098.0
  • Compiler used:
    Microsoft Visual Studio Community 2022
    Version 17.3.6
    VisualStudio.17.Release/17.3.6+32929.385
    Microsoft .NET Framework
    Version 4.8.04161
    Installed Version: Community
    Visual C++ 2022 00482-90000-00000-AA258
    Microsoft Visual C++ 2022
Lenguaje dominante
Python
Estrellas
77.2k
Forks
36k
Merge medio
1 d 9 h
PR fusionados (30 d)
558

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.

Más de python/cpython

Todos los issues de python/cpython

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.