-
Notifications
You must be signed in to change notification settings - Fork 39
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
Cannot read/write image in a folder with cyrillic name, on windows #21
Comments
This error,
What you're dealing with is obviously the second case. Most of the functions provided by pyexiv2 include a default parameter: img = pyexiv2.Image(image_path, encoding='utf-8')
img = pyexiv2.Image(image_path, encoding='ISO 8859-5') In addition, the default encoding for your Windows system may not be utf-8, so you cannot decode in utf-8. |
yeah, I suspect it, but not get why 😉 file = open(image_path, "r") works very well, without any encoding (it detected internally). Is there a way to give the
That also an idea, I will try locale.getpreferredencoding() , will see what it will do, and will write you back. |
In fact, pyexiv2 calls the C++ API of exiv2. Therefore, only one string representing the path of the file can be passed. |
okay, I have tried locale.getpreferredencoding() but it does not help,
I understood, However, how does native file = open(path, 'r');
img = pyexiv2.Image(file.name); but still no luck |
As far as I know, executing |
The default encoding format in Linux system is utf-8, so you can use utf-8 to decode file paths. leo@Leo:~$ echo $LANG
C.UTF-8 |
hm, with I tried default encoding cp1252 but it not able to encode cyrillic, and if use cp1251 then it able to encode cyrillic but pyexiv2.Image stlll fail with exception. well, okay |
@LeoHsiao1 one more question Does it possible to implement this method static Image::AutoPtr open (const byte *data, long size) ? So I can do: the_file = open("in-file", "rb")
data = the_file.read()
img = pyexiv2.Image(binary_data = data) I think that would be nice feature. |
It looks like it can be done, and I'll try to do it in the next week. |
I've implemented this method and will release a new version in a few days. |
@LeoHsiao1 thanks! works very well, I just tested |
Hi @LeoHsiao1 ! I'm having a bit of trouble following how to use the new class to solve cyrillic/other non-ascii names. The code right now looks like this:
Is it as simple as changing the first line to:
Unfortunately it still doesn't work for me... |
This issue has been automatically closed because there has been no activity for a month. |
The library cannot read/write the image from folder that contain cyrillic symbols, on windows, however on Linux it works very well.
Example little thing:
Produce error
Failed to open the data source: No such file or directory (errno = 2)
Traceback:
api.open_image()
does not see the file in some reason.If use path without cyrillic symbols then all works.
The text was updated successfully, but these errors were encountered: