Importing test libraries failed. No module named 'a'

孤人 提交于 2019-12-13 08:01:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!