Let's say I have two filepaths:
/my/file/path.mov
/mé/fileé/pathé.mov
If I do something like:
{hashlib.md5(path).hexdigest() for path in paths}
Then I'll sometimes get the following error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xc1' in position 217: ordinal not in range(128)
My quickfix was something along the lines of:
{hashlib.md5(path).hexdigest() for path in paths if path.isascii()}
But what would be a better way to deal with this?