Skip to content

__init__.py causes No module named 'adblock.adblock' #17

@The-Compiler

Description

@The-Compiler

After building via maturin build and installing the wheel via pip, running python3 -c "import adblock" results in:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/florian/tmp/python-adblock/adblock/__init__.py", line 1, in <module>
    from .adblock import __version__, Engine, FilterSet, BlockerResult, UrlSpecificResources
ModuleNotFoundError: No module named 'adblock.adblock'

This is because the adblock module gets imported, and due to from .adblock import, Python tries to import adblock.adblock.

When trying again outside of the git repository, the import works fine.

It looks like that adblock module is only required for type annotations? Is the __init__.py really required, and is the import even correct? Perhaps it could be moved to src/ somehow to not interfere with the native extension module?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions