2017-04-02 106 views
0
def oratab(ip, username,password): 
    # ip = '10.10.10.10' 
    # username = 'root' 
    # password = 'password' 
    remote_conn_pre = paramiko.SSHClient() 
    remote_conn_pre.set_missing_host_key_policy(paramiko.AutoAddPolicy()) 
    remote_conn_pre.connect(ip, username, password, look_for_keys=False, 
          allow_agent=False) 
    ... the function returns the files listing on Linux machine 

def reply(ip, username, password): 
    showinfo(title='Reply', message=list(oratab(ip, password, username))) 

top = Tk() 
Label(top, text='enter IP: ').pack() 
ent = Entry(top) 
ent.pack() 
Label(top, text='enter username: ').pack() 
ent2 = Entry(top) 
ent2.pack() 
Label(top, text='enter password: ').pack() 
ent3 = Entry(top) 
ent3.pack() 
btn = Button(top, text='Submit', command=(lambda: reply(ent.get(), ent2.get(), ent3.get()))) 
btn.pack() 
top.mainloop() 

> addrinfos = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM) 
> gaierror: [Errno 10109] getaddrinfo failed 

如果我通過IP只(DEF的oratab(IP)和高清回覆(IP)),並指定用戶名和密碼上的oratab功能(只需在去除註釋標記2行)它將返回正確的結果。errno的10109點的getaddrinfo失敗返回

這是什麼與我的拉姆達不採取第二個和第三個參數在tkinter窗口內:http://prntscr.com/erg1hs

回答

相關問題