Skip to content

Commit 81518ce

Browse files
refeedambv
andauthored
gh-125873: Improve error message when PYTHONHOME is invalid (#126027)
Co-authored-by: Lukasz Langa <ambv@meta.com>
1 parent 1a4dfd1 commit 81518ce

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improved error message when an environment variable is misconfigured.

‎Python/codecs.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,9 @@ _PyCodec_InitRegistry(PyInterpreterState *interp)
16931693
if (mod == NULL) {
16941694
PyThreadState *tstate = _PyThreadState_GET();
16951695
_Py_DumpPathConfig(tstate);
1696-
return PyStatus_Error("Failed to import encodings module");
1696+
return PyStatus_Error("Failed to import encodings module. "
1697+
"Your environment probably has misconfigured variables! "
1698+
"Please check PYTHONHOME otherwise refer to `--help-env`");
16971699
}
16981700
Py_DECREF(mod);
16991701

0 commit comments

Comments
 (0)