3.11 Regression, Py_Initialize; Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Domaine
- api, operating-systems
Piste de recherche
Commencez par le programme C qui utilise Py_Initialize et Python.h, en reproduisant le comportement sous Windows 11 avec Python 3.11. Comparez l’exécution avec la python311.dll installée, une DLL copiée et des versions antérieures de Python, puis étudiez comment l’initialisation localise Lib/encodings. Le travail est terminé lorsque la DLL Python 3.11 copiée peut s’initialiser sans copier séparément le répertoire encodings.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- Python
- Étoiles
- 77.2k
- Forks
- 36k
- Merge moyen
- 1 j 9 h
- PR mergées (30 j)
- 558
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python/cpython
-
docs pending
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
stdlib type-feature
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
stdlib type-feature
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
build type-bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
stdlib topic-email type-feature
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Toutes les issues de python/cpython
Issues similaires
-
link-check link-check:sphinx-theme
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
OpenHands/extensions#626 · 1 commentaire ·
-
Change observation tooltip text Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
CSCfi/sd-search-api#39 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100