Skip to content
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

Problem with mixing up use-str with use-path (ModuleNotFoundError: __path__ attribute not found #477

Open
amogorkon opened this issue Jun 21, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@amogorkon
Copy link
Owner

tried to use("tagger.py") a file in a parent directory, which should raise some good error but instead it crashed with

ImportError while importing test module 'f:\Dropbox (Privat)\code\JKitten\tests\test_units.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
G:\Python398\lib\importlib\util.py:96: in find_spec
    parent_path = parent.__path__
E   AttributeError: module 'tagger' has no attribute '__path__'

The above exception was the direct cause of the following exception:
G:\Python398\lib\importlib\__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests\test_units.py:6: in <module>
    tagging = use("tagger.py")
G:\Python398\lib\site-packages\use\main.py:135: in __call__
    return self.__implementation(*args, **kwargs)
G:\Python398\lib\site-packages\use\tools.py:46: in wrapper
    return dispatcher.dispatch(args[1].__class__)(*args, **kwargs)
G:\Python398\lib\site-packages\use\main.py:669: in _use_str
    return self._use_package(
G:\Python398\lib\site-packages\icontract\_checkers.py:641: in wrapper
    result = func(*args, **kwargs)
G:\Python398\lib\site-packages\use\main.py:725: in _use_package
    spec = importlib.util.find_spec(module_name.replace("-", "_"))
G:\Python398\lib\importlib\util.py:98: in find_spec
    raise ModuleNotFoundError(
E   ModuleNotFoundError: __path__ attribute not found on 'tagger' while trying to find 'tagger.py'
@amogorkon amogorkon self-assigned this Jun 21, 2022
@amogorkon amogorkon added the bug Something isn't working label Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant