-
Notifications
You must be signed in to change notification settings - Fork 55
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
The 'ascii' encoding cannot open images whose file names contain special characters #176
Comments
The |
If there is no ³, it can be read normally
|
Ok so this has nothing to do with the A lot of this code has been updated but apparently not released. Could you try installing pylibtiff from the github master branch and see if you get a different result? |
I updated to 0.6.1, but I don't have the libtiff.dll file, I don't know where to download a valid dll file, I once downloaded one, but it doesn't seem to be the right file. 😂 |
You have to pip install from the source code to generate the dll. |
I tried to use pip install many times, but it was strange that no dll file was generated, I came up with another way to copy the dll file from version 0.4.4 to the system, and the result was that ordinary file names could be read normally. The message "JPEG compression support is not configured" no longer appears, but special characters cannot be read properly |
I'm not sure I fully understand, but I realize you might be talking about the libtiff dll for the C libtiff library and not anything from pylibtiff, right? I also don't understand what situations worked for you and which ones didn't. Just like the other filename issue you created (#152) some of these issues seem to be some disconnect/conflict between your python installation and your filesystem. The github master version of pylibtiff should be doing everything correctly as far as I understand and remember to be handling non-ascii filenames the best way possible. I'm not sure how else to test these types of things since a lot of them seem to be specific to your system. |
I'll try again and see what the problem is |
Your errors have nothing to do with "ascii". As your warning/error message said it is trying to use the gbk encoding:
There is some conflict/inconsistency between the encoding your file system is actually using to store filenames and what encoding python/file system is saying it is using. As mentioned, the "ascii" you see in the code is all about the |
Ok, so does pylibtiff support reading byte objects? I want to avoid file name problems by converting images to byte objects. |
I used TIFFfile instead and it reads the special characters normally |
Test environment:
win10
python3.8.10
pylibtiff0.4.4
filename: 483×55³MDI.tif
site-packages\libtiff\libtiff_ctypes.py", line 489, in open
tiff = libtiff.TIFFOpen(filename, mode.encode('ascii'))
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
The text was updated successfully, but these errors were encountered: