Python 3: os.walk() file paths UnicodeEncodeError: ‘utf-8’ codec can’t encode: surrogates not allowed
On Linux, filenames are ‘just a bunch of bytes’, and are not necessarily encoded in a particular encoding. Python 3 tries to turn everything into Unicode strings. In doing so the developers came up with a scheme to translate byte strings to Unicode strings and back without loss, and without knowing the original encoding. They …