skip to Main Content

I try to access auditor folder from another folder like this

from auditor.evaluation.expected_behavior import SimilarGeneration

Project Hierarchy

However, I get this error "No module named ‘auditor’"

I tried many ways like:

from ..auditor.evaluation.expected_behavior import SimilarGeneration

or

from .auditor.evaluation.expected_behavior import SimilarGeneration

and I also tried to add a sys path in order ro access this module. However, none of them worked for me.

I use Visual Studio Code as an IDE.

Do you have any suggestions?

Thanks a lot.

2

Answers


  1. Chosen as BEST ANSWER

    My supervisor solved this issue like that:

    import sys
    sys.path.append("../fiddler-auditor-main")
    

    I do not know why but it works with this path.


  2. You can add your folder to sys.path. Add this code at start of your file:

    import sys
    sys.path.append(“.”) #if it doesn’t work, replace “.” by the auditor’s folder
    import auditor
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search