1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Why do I keep getting ModuleNotFoundError: No module named 'src'.?

Discussão em 'Python' iniciado por Stack, Setembro 14, 2024.

  1. Stack

    Stack Membro Participativo

    Whenever I have to import from src module, this error occurs.

    I'm trying to import in data_ingestion.py

    Structure:

    src/
    components/
    data_ingestion.py


    This is the code I am working on:

    import os
    import sys
    from src.exception import CustomException


    This is the error:

    Traceback (most recent call last):
    File "/home/...../src/components/data_ingestion.py", line 4, in <module>
    from src.exception import CustomException
    ModuleNotFoundError: No module named 'src'


    I tried adding the module's directory to the sys.path list, to no effect.

    How can I resolve this?

    Continue reading...

Compartilhe esta Página