From: Samuele P. <ped...@bl...> - 2004-02-05 13:47:36
|
At 19:05 04.02.2004 +0100, Samuele Pedroni wrote: >At 12:22 04.02.2004 -0500, Satya Ghattu wrote: >>Hello, >>When I try to execute a script, often sometimes I get this error, >> >>> execfile("tmp_config-resources.py") >>Traceback (innermost last): >> File "<input>", line 1, in ? >>UnicodeError: unicode escape decoding error: truncated \xXX >> >>Anybody knows how to debug this problem? > >Jython 2.1 on java1.3.0 (JIT: null) >Type "copyright", "credits" or "license" for more information. > >>> u"\u00" >Traceback (innermost last): > (no code object) at line 0 >UnicodeError: unicode escape decoding error: truncated \uXXXX > >>> u"\u0000" >'\x00' > >>> > >\u escapes expect 4 hex digits. oops, and \x expects exactly 2 hex digits. Jython 2.1 on java1.3.0 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> "\xf" Traceback (innermost last): (no code object) at line 0 UnicodeError: unicode escape decoding error: truncated \xXX >>> "\xff" '\xFF' >>> the error message can seem a bit misleading, but in Jython all strings are unicode. in CPython: Python 2.1.3 (#35, Apr 8 2002, 17:47:50) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. >>> '\xf' ValueError: invalid \x escape >>> u'\xf' UnicodeError: Unicode-Escape decoding error: truncated \xXX escape >>> it should be noted that UnicodeError is a subclass of ValueError. |