3.11 Regression, Py_Initialize; Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 36k
- Merge medio
- 1g 9h
- PR unite (30g)
- 558
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con il programma C che usa Py_Initialize e Python.h, riproducendo il comportamento su Windows 11 con Python 3.11. Confronta l’esecuzione con la python311.dll installata, una DLL copiata e versioni precedenti di Python, quindi analizza come l’inizializzazione individua Lib/encodings. Il lavoro è completato quando la DLL Python 3.11 copiata può inizializzarsi senza copiare separatamente la directory encodings.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, python
- Ambito
- api, operating-systems
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100