Skip to content

Import is resolving the wrong module #937

@fraenkel

Description

@fraenkel

If you have a submodule under tasks that has the same name as a top-level module, the import will fail.

For example, I have a module named common which is located in my site-packages.
My tasks directory looks like:

/project
  /tasks
    __init__.py
    common.py
     

The issue is pretty simple,
https://github.com/pyinvoke/invoke/blob/main/invoke/loader.py#L77

import common now comes from /project/tasks instead of my site-packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions