-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show a better error message when PYTHONHOME is wrong #125873
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-feature
A feature request or enhancement
Comments
ZeroIntensity
added
the
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
label
Oct 23, 2024
I think the most reasonable fix would be to change this line to something like: return PyStatus_Error("Failed to import encodings module. Are you sure PYTHONHOME is correct?"); PR welcome! |
refeed
added a commit
to refeed/cpython
that referenced
this issue
Oct 27, 2024
refeed
added a commit
to refeed/cpython
that referenced
this issue
Oct 27, 2024
You can also damage
|
You could, but what makes |
refeed
added a commit
to refeed/cpython
that referenced
this issue
Oct 27, 2024
refeed
added a commit
to refeed/cpython
that referenced
this issue
Oct 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-feature
A feature request or enhancement
Feature or enhancement
Proposal:
Currently, when
PYTHONHOME
is wrong, python saysModuleNotFoundError: No module named 'encodings'
. This is error makes it sound like a module is missing, when it's actually a part of the core interpreter configuration that is broken, which the error doesn't tell.Ideally, the error would show if a
pyvenv.cfg
was loaded, as a wronghome
path causes this error.Example pyenv Python 3.12 on Ubuntu 24.04:
Example python-build-standalone on Ubuntu 24.04:
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
There are several bug reports featuring this error: https://github.com/python/cpython/issues?q=is%3Aissue+%22ModuleNotFoundError%3A+No+module+named+%27encodings%27%22+
https://stackoverflow.com/questions/38132755/importerror-no-module-named-encodings
The error is occurring for users in various communities: https://www.google.com/search?q=%22ModuleNotFoundError%3A+No+module+named+%27encodings%27%22
Linked PRs
The text was updated successfully, but these errors were encountered: