【发布时间】:2018-06-16 12:25:03
【问题描述】:
我有一个python类,文件名是one.py
class one:
def __init__(self,dict1,connect=False):
self.device=dict1['device']
self.ip=dict1['ip']
self.uname=dict1['uname']
self.password=dict1['password']
self.dict1={'device':self.device, 'ip':self.ip,'uname':self.uname,self.password:self.password}
self.is_connect=False
self.is_config_mode=False
if connect:
self.connects_to()
def connects_to(self):
netconn=ConnectionHandler(self.dict1)
print "stuff"
我需要从机器人文件中调用函数connects_to。
*** Settings ***
Library LibFiles/one.py
Library OperatingSystem
Library String
Library Collections
*** Keywords ***
Test_1 ${equip1}
${dict1}= Create Drictionary device=auto1 ip:192.38.19.20 secret=${EMPTY} uname=Adrija password=Hello port=22
${a}= connects_to ${dict1} connect=${True}
但我得到的错误是方法 connected_to() 不存在。 请帮忙。
谢谢。
【问题讨论】:
-
请包括错误的确切措辞。它准确地告诉你问题是什么。仔细阅读,从字面上理解。