Error Message When Running Telnet In Python Shell
Below is a minimal example of my code, which If you run, should recreate the problem I have. One thing I have encounter that the error does not appear if my raspberry pi (the thing
Solution 1:
The telnet interface probably wants to work in bytes not Unicode. I have tested this code on Python3 and it avoids the error:
import telnetlib
bot = telnetlib.Telnet("127.0.0.1", 22)
user = "dobbs"
bot.write((user + "\n").encode('ascii'))
print(bot.read_all())
Post a Comment for "Error Message When Running Telnet In Python Shell"