首页 > 解决方案 > 导入关键字机器人框架时的问题

问题描述

我正在从一个单独的 python 文件中导入关键字,但是当我在机器人文件中使用这个关键字时,会出现一个错误,表明这个关键字没有被声明。

例如,例程控件在 UdsServices 中声明,当我在测试用例中使用它时,它似乎没有声明

*** Settings ***
Library        UdsServices
Variables     ../python_files/Input_variables.py
#Variables      C:/Users/sghribi/eclipse-workspace/robot_UCM-NANO/Ressources/python_files/Input_variables.py


*** Keywords ***
Configure Input Channel
    [Arguments]  @{Framedatas}
    Routine Control  ${CIC_Routine_ID}  ${Framedatas}

例程控制函数在 UdsServices 文件中与文件同名的类中声明

def routine_control(self, RoutineID, datas=None):

global result
response = None
data = bytes([int(x, 16) for x in datas.split(" ")]) if datas else None
with Client(connexion, request_timeout=3) as client:
    try:
        response = client.routine_control(routine_id=int(RoutineID, 16), control_type=0x01, data=data)
        result = response.data[3:]
    except NegativeResponseException as e:
        print(response.data)
        print('Server refused our request for service %s with code "%s" (0x%02x)' % (
            e.response.service.get_name(), e.response.code_name, e.response.code))
    except InvalidResponseException as e:
        print('Server sent an invalid payload : %s' % e.response.original_payload)
return result

我正在使用 eclipse 和 red,并在 red.xml 文件中添加了库。

标签: eclipserobotframework

解决方案


推荐阅读