Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
gh-127598: Improve ModuleNotFoundError when -S is passed#136821
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
gh-127598: Improve ModuleNotFoundError when -S is passed#136821
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks, please add a test case and news entry.
ilovelinux left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should we write a test for that?
Lib/traceback.py Outdated
elifexc_typeandissubclass(exc_type,ModuleNotFoundError)and \ | ||
sys.flags.no_site: | ||
self._str+=". Site initialization is disabled, did you forget to add the\ | ||
site-package directory to sys.path?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Traceback message has too many spaces in the middle:
ModuleNotFoundError: No module named 'foo'. Site initialization is disabled, did you forget to add the site-package directory to sys.path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It should be fixed now, please test it again
@ZeroIntensity I've also add an additional check to exception as a suggestion from@encukou, I'll add also a test for it |
Uh oh!
There was an error while loading.Please reload this page.
This (partially) solvesgh-127598 by adding flavour text to exception when the argument '-S' is passed.
ImportError
for common issues #127598