[Python] Import error for direct execution of __init__.py in package

Discussão em 'Python' iniciado por Stack, Fevereiro 8, 2025.

  1. Stack

    Stack Membro Participativo

    import sys

    sys.path.append(".")
    from . import module


    Package structure:

    TestPackage

    |-> init.py

    |-> module.py

    from . import module

    ImportError: attempted relative import with no known parent package

    Direct command line execution: python PATH_TO_INIT.PY gives the above error Anyone know why im getting this error?

    Continue reading...

Compartilhe esta Página