I'm a complete newbie in Python, but I have been programming for fun in (Liberty-)Basic since about 1980.
Using Python 3.5.2 I was testing this script:
import time, telnetlib
host = "dxc.ve7cc.net"
port = 23
timeout = 9999
try:
session = telnetlib.Telnet(host, port, timeout)
except socket.timeout:
print ("socket timeout")
else:
session.read_until("login: ")
session.write("on0xxx\n")
output = session.read_some()
while output:
print (output)
time.sleep(0.1) # let the buffer fill up a bit
output = session.read_some()
Can anyone tell me why I get the TypeError: a bytes-like object is required, not 'str' and how I can solve it?