导入库失败:在机器人框架中 [英] Importing library failed: in robotframework

查看:61
本文介绍了导入库失败:在机器人框架中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了 python 文件并尝试将其导入我的机器人项目.下面是 python 文件名 helloworld.py,

I have created python file and trying to import that to my robot project.Below is the python file name 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

我尝试了所有可能的解决方案,但没有任何效果:(

I tried all the possible solution but nothing worked :(

推荐答案

指定库的名称可以解决问题.只需在您的机器人中使用 helloworld.py.

Specifing the name of the library fixes the problem. Just use helloworld.py in your robot.

*** Settings ***
Library    helloworld.py

*** Test Cases ***

TC1
    Fun Scope

这篇关于导入库失败:在机器人框架中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆