Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
MonadChains wants to merge3 commits intopython:main
base:main
Choose a base branch
Loading
fromMonadChains:gh-127598/improve-ModuleNotFoundError

Conversation

MonadChains
Copy link
Contributor

@MonadChainsMonadChains commentedJul 19, 2025
edited
Loading

This (partially) solvesgh-127598 by adding flavour text to exception when the argument '-S' is passed.

Copy link
Member

@ZeroIntensityZeroIntensity left a 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.

Copy link

@ilovelinuxilovelinux left a 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?

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?"

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?

Copy link
ContributorAuthor

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

@MonadChains
Copy link
ContributorAuthor

@ZeroIntensity I've also add an additional check to exception as a suggestion from@encukou, I'll add also a test for it

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ZeroIntensityZeroIntensityZeroIntensity left review comments

@ilovelinuxilovelinuxilovelinux requested changes

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@MonadChains@ilovelinux@ZeroIntensity

[8]ページ先頭

©2009-2025 Movatter.jp