Issue 593696: telnetlib raises UnboundLocalError (original) (raw)
I have a tiny test script that causes telnetlib to crash due to an UnboundLocalError exception. I tested this on Python 2.2.1 on Linux and OpenBSD. Here is the uname output of both test machines: OpenBSD ark2 2.9 GENERIC#653 i386 Linux starship.python.net 2.2.19-6.2.12smp #1 SMP Fri Oct 26 11:29:57 EDT 2001 i686 unknown
Here is the script:
import telnetlib tn = telnetlib.Telnet ("surfers.org", 4242) tn.read_until ("Please enter your name:") tn.write ("Mongo\n") tn.read_until ("just connect to Surfers:")
Here is the exact error:
python term.py
Traceback (most recent call last): File "term.py", line 6, in ? tn.read_until ("just connect to Surfers:") File "/usr/local/lib/python2.2/telnetlib.py", line 297, in read_until self.process_rawq() File "/usr/local/lib/python2.2/telnetlib.py", line 424, in process_rawq self.msg('IAC %d not recognized' % ord(opt)) UnboundLocalError: local variable 'opt' referenced before assignment
Let me know if I can provide more information.
Yours, Noah