Skip to content

Improve error message for absolute relative imports #4408

@pcaversaccio

Description

@pcaversaccio

The PR #4268 disallows absolute relative imports, but the error is not really helpful if the disallowed import is somewhere nested in some imported modules or interface files; e.g.:

Error compiling: src/snekmate/tokens/mocks/erc1155_mock.vy
FileNotFoundError: could not find IERC1155.vy in any of the following locations:
  /../snekmate/src/snekmate/tokens/mocks/IERC1155.vy
  IERC1155.vy
  /../.pyenv/versions/3.12.3/bin/IERC1155.vy
  /../.pyenv/versions/3.12.3/lib/python312.zip/IERC1155.vy
  /../.pyenv/versions/3.12.3/lib/python3.12/IERC1155.vy
  /../.pyenv/versions/3.12.3/lib/python3.12/lib-dynload/IERC1155.vy
  /../.local/lib/python3.12/site-packages/IERC1155.vy
  /../.pyenv/versions/3.12.3/lib/python3.12/site-packages/IERC1155.vy

The above exception was the direct cause of the following exception:

vyper.exceptions.ModuleNotFound: IERC1155

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