Skip to content Skip to sidebar Skip to footer

How To Open Telnet As A Textfile Rather Than A Binary File

So I was trying to use the read_until method in telnet but then ran into the error: Traceback (most recent call last): File 'c:\Users\Desktop\7DTD Bot\test.py', line 44, in

Solution 1:

The error is saying the PORT should be of type int or a bytes-like object. Currently it is type str. Convert the PORT variable to an int like this.

tn = telnetlib.Telnet(HOST, int(PORT))

Solution 2:

I'm not sure if there's a better way to do it but I just converted the string to a bytestring to fix this problem:

tn.read_until(b"Please enter password:")

And also thanks for the minus one!

Post a Comment for "How To Open Telnet As A Textfile Rather Than A Binary File"