Python on windows defaults to legacy window encodings (cp1252). It's saying that it encountered a codepoint (0x9d) that is not in cp1252.
Best would be to understand what encoding the file "really" is. If it's UTF-8, you can easily switch the default by adding
Rarer, it could be some other encoding. You can set your decoding explicitly in the
The "r" string isn't a problem. It's a "raw" string format. Among other things, it makes it easier to type in strings with backslashes. Handy for windows-style file literals.
Best would be to understand what encoding the file "really" is. If it's UTF-8, you can easily switch the default by adding
-Xutf8
on the command line, or set the environment variable PYTHONUTF8=1
.Rarer, it could be some other encoding. You can set your decoding explicitly in the
open()
The "r" string isn't a problem. It's a "raw" string format. Among other things, it makes it easier to type in strings with backslashes. Handy for windows-style file literals.
>>> print("a\b\c") \c >>> print(r"a\b\c") a\b\c