问题
I have a folder /example
which contains /Libs
which further contains different folders /a
, /b
each containing python
libraries. I am trying to run a robot
framework code from /example
.
The error it shows :
Importing test library 'a' failed: ImportError: No module named 'a' File "/root/Libs/a/init.py", line 7, in from a import a_classname
How can I solve this?
回答1:
import os
import sys
filepath = "path/file/"
sys.path.append(os.path.abspath(filepath))
from a import a_classname
来源:https://stackoverflow.com/questions/57091689/importing-test-libraries-failed-no-module-named-a