导入库失败:在机器人框架中
Importing library failed: in robotframework
我已经创建了 python 文件并尝试将其导入我的机器人 project.Below 是 python 文件名 helloworld.py,
class helloworld:
ROBOT_LIBRARY_SCOPE = 'TESTCASE'
def fun_scope(self):
print("Hello World")
下面是机器人脚本,
*** Settings ***
Library helloworld
*** Test Cases ***
TC1
Fun Scope
执行时出现以下错误,
[ ERROR ] Error in file '/home/sadha/PycharmProjects/NotificationService/Test/custom.robot' on line 2: Importing library 'helloworld' failed: ModuleNotFoundError: No module named 'helloworld'
Traceback (most recent call last):
None
PYTHONPATH:
/home/sadha/PycharmProjects/NotificationService/venv/bin
/usr/lib/python38.zip
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
/home/sadha/PycharmProjects/NotificationService/venv/lib/python3.8/site-packages
我尝试了所有可能的解决方案,但没有任何效果:(
指定库的名称可以解决问题。只需在您的机器人中使用 helloworld.py。
*** Settings ***
Library helloworld.py
*** Test Cases ***
TC1
Fun Scope
我已经创建了 python 文件并尝试将其导入我的机器人 project.Below 是 python 文件名 helloworld.py,
class helloworld:
ROBOT_LIBRARY_SCOPE = 'TESTCASE'
def fun_scope(self):
print("Hello World")
下面是机器人脚本,
*** Settings ***
Library helloworld
*** Test Cases ***
TC1
Fun Scope
执行时出现以下错误,
[ ERROR ] Error in file '/home/sadha/PycharmProjects/NotificationService/Test/custom.robot' on line 2: Importing library 'helloworld' failed: ModuleNotFoundError: No module named 'helloworld'
Traceback (most recent call last):
None
PYTHONPATH:
/home/sadha/PycharmProjects/NotificationService/venv/bin
/usr/lib/python38.zip
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
/home/sadha/PycharmProjects/NotificationService/venv/lib/python3.8/site-packages
我尝试了所有可能的解决方案,但没有任何效果:(
指定库的名称可以解决问题。只需在您的机器人中使用 helloworld.py。
*** Settings ***
Library helloworld.py
*** Test Cases ***
TC1
Fun Scope