SyntaxError: invalid syntax (windows)
tjreedy at udel.edu
Wed Mar 25 19:34:26 CET 2009
> Python Newsgroup wrote:
>> Gotcha, I got started from the telnet example listed in the docs. The
>> linux install was via yum and installed 2.x instead. That explains it.
>> Althought print (tn.read_all () ) runs in 2.x on linux.
>> I have another problem maybe you cna help me with. My telnet output
>> jibberish in windows: I cna parse some of the output for results but
>> is there anyway to get rid of the jibberish. (looks like hex but I'm
>> not sure)
>> I can only use this tn.read_until(b'whatever string') Is this whats
>> causing the output? the b switch. seems like I don't need it in linux.
>> is that binary?
>> C:\Python30>python \Python30\scripts\telnet-tftp1.py
> They look like control sequences for a terminal.
Indeed. \x1b == \033 == 27 == ESCAPE. 'ESC [' is the standard prefix
for ANSI terminal control sequences.
"32-bit character-mode (subsystem:console) Windows applications don't
write ANSI escape sequences to the console. They must interpret the
escape code actions and call the native Console API instead to
accomplish the proper result. If you do write the sequences directly,
all you'll get is the text of the sequence on the screen, not the action
I mostly see a crazy mixture of ESC [ row , col H cursor position
commands. For you app, parse out and ignore the codes not skipped by
Terry Jan Reedy
More information about the Python-list