Skip to content

Comments

GH-145006: add ModuleNotFoundError hints when a module for a differen…#145007

Open
FFY00 wants to merge 1 commit intopython:mainfrom
FFY00:gh-145006
Open

GH-145006: add ModuleNotFoundError hints when a module for a differen…#145007
FFY00 wants to merge 1 commit intopython:mainfrom
FFY00:gh-145006

Conversation

@FFY00
Copy link
Member

@FFY00 FFY00 commented Feb 19, 2026

Python 3.15.0a6+ free-threading build (heads/main-dirty:f282f7aed91, Feb 19 2026, 17:33:04) [GCC 15.2.1 20260209] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import foo.ext
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import foo.ext
ModuleNotFoundError: No module named 'foo.ext'. Although a module with this name was found for a different Python version (cpython-315-x86_64-linux-gnu).

…fferent ABI exists

Signed-off-by: Filipe Laíns <lains@riseup.net>
@benediktjohannes
Copy link
Contributor

Unforetunately, multiple checks seem to be failing, I'll have a look on this

import collections.abc
import itertools
import linecache
import os
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import os
import os
from pathlib import Path

traversable = importlib.resources.files(parent)
else:
traversable = importlib.resources.readers.MultiplexedPath(
*filter(os.path.isdir, sys.path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*filter(os.path.isdir, sys.path)
*[Path(p) for p in sys.path if os.path.isdir(p)]

Copy link
Contributor

@benediktjohannes benediktjohannes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that this should fix the failing tests

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants