ahupp / python-magic

A python wrapper for libmagic
Other
2.65k stars 283 forks source link

Does not work if filename has non-English characters #335

Open denivic opened 1 month ago

denivic commented 1 month ago

The following code fails if the file has æ, å or ø in it. I can imagine it would fail with other non-English characters as well. Would it be possible to fix this?

import magic as m

print(m.from_file(r'C:\Users\------\Desktop\data\æøå.pdf'))

Error:

cannot open `C:\Users\------\Desktop\data\æøå.pdf' (No such file or directory)