Postingan lainnya
Typeerror: expected str, bytes or os.pathlike object, not entry
misi mas/mbak, saya punya masalah jadi gini saya kan nyoba untuk membuat sshclient dengan menggunakan module di bawah, dan dengan tambahan sedikit GUI memakai Tkinter 8.6 dan python saya python 3.6, saya RUN itu dia bisa/jalan muncul GUInya cuman kok pas saya udah isi semuanya, ada bacaan seperti ini ya?
Traceback (most recent call last):
File "client.py", line 72, in <module>
subSSH()
File "client.py", line 11, in subSSH
stderr=subprocess.PIPE)
File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1275, in _execute_child
restore_signals, start_new_session, preexec_fn)
TypeError: expected str, bytes or os.PathLike object, not Entry
saya sudah mencari-cari masalahnya dan belum ketemu :3
berikut contoh kode saya di bawah
import subprocess
import sys
from tkinter import *
def subSSH():
ssh = subprocess.Popen(["ssh", "%s" % adr, user, passw, port_number],
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
result = ssh.stdout.readlines()
if result == []:
error = ssh.stderr.readlines()
print >>sys.stderr, "ERROR: %s" % error
else:
print (result)
window = Tk()
window.geometry("400x308")
window.resizable(0,0)
frame = Frame(window, bd=2)
frame.grid(column=1, row=1)
########### USERNAME ##############
username = Label(frame, text="Username", fg="#30336b")
username.grid(column=2, row=3)
user = Entry(frame)
user.grid(column=2, row=4)
######### PASSWORD ###############3
password = Label(frame, text="Password", fg="#30336b")
password.grid(column=3, row=3)
passw = Entry(frame, show="*")
passw.grid(column=3, row=4)
########## IP ADDRESS #############
ip = Label(frame, text="Ip Address", fg="#30336b")
ip.grid(column=2, row=5)
adr = Entry(frame)
adr.grid(column=2, row=6)
########## PORT NUMBER ################
port = Label(frame, text="Port Number", fg="#30336b")
port.grid(column=3, row=5)
port_number = Entry(frame)
port_number.grid(column=3, row=6)
#####################################################
ok = Button(frame, text="Connect", command=subSSH)
ok.grid(column=3, row=10)
cancel = Button(frame, text="Cancel", command=quit)
cancel.grid(column=2, row=10)
window.title("Client Login")
window.mainloop()
if __name__ == "__main__":
subSSH()
sebelumnya terimakasih
0
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban