-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnicodeDecodeError when filename includes non ASCII characters #287
Comments
Hi, I have the same problem. My code is:
My error is:
I tried to edit "C:\Program Files\Python38\lib\site-packages\magic\magic.py", line 214 from |
This happens if the system encoding is not UTF-8 and unicode characters are provided in the file path. Most often this is a problem on Windows. For details, see Some solutions, none of them perfect, are:
Another idea I had was to encode the file path as a byte string in the system encoding, but due to another bug that doesn't work. |
trying to read from a file whose filename is not ascii characters:
And this gives me error:
If I rename the file to ASCII name, say
file.txt
, the problem disappears.Also, if I use
.from_buffer()
, there's no issue:weird, not sure if this is related to this issue #205
The package is installed with
pip install python-magic-bin
on WIndows 11, Python3.11The text was updated successfully, but these errors were encountered: