Skip to content Skip to sidebar Skip to footer

Python Import Module Error

I have a problem in import of modules in my project. I was creating tests and I cant import my main to test one end point of my application, from the test file teste_ex.py. This is

Solution 1:

Here's my best guess as to what might help:

You should make sure that the path to the directory in which your main.py file resides can be found in sys.path. You can check this yourself by running this snippet in test_ex.py:

import sys

for line in sys.path:
    print line

If the directory in which main.py is found is not included in your path, you can append that path to sys.path, like this (include this snippet in test_ex.py):

import sys
sys.path.append("/path/to/your/module/backendapi/api/")

Post a Comment for "Python Import Module Error"