Python Forum
unicode error message - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: unicode error message (/thread-5543.html)



unicode error message - Skaperen - Oct-10-2017

i got this error message:

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-9: illegal Unicode character

what does the part bytes in position 0-9 refer to?


RE: unicode error message - hbknjr - Oct-10-2017

It's the index illegal characters in your byte object, that can't be decoded with Unicode-escape.

https://docs.python.org/3/library/exceptions.html#UnicodeError

Quote:start
The first index of invalid data in object.

end
The index after the last invalid data in object.



RE: unicode error message - Skaperen - Oct-11-2017

i found the problem. the code exceeded 0x010ffff (1114111) and thus was not valid unicode and so it could not be encoded into utf-8.