LeoHsiao1 / pyexiv2

Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile.
GNU General Public License v3.0
197 stars 39 forks source link

"encoding" keyword does not exist? #82

Closed virtualnobi closed 2 years ago

virtualnobi commented 2 years ago

Hi, and thanks for the nice tool!

I am now faced with filenames containing German umlauts, which are not readable by pyexiv2.Image(path).read_exif() due to the umlaut, I assume:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa8 in position 97: invalid start byte

Following the tutorial, I tried pyexiv2.Image(path, encoding='ISO-8859-1'), which raises the exception:

TypeError: init() got an unexpected keyword argument 'encoding'

The filename contains the umlaut ü (albeit at position 73; the filename is only 90 characters long). Without this character, metadata loads fine.

I'm running Python 3.8 on Windows 8.1, just downloaded then newest version of pyexiv2.

LeoHsiao1 commented 2 years ago

Hi! Could you run the following command to check the installation information of pyexiv2?

pip show pyexiv2

In addition, even if you could set the parameter encoding, I don't know if German characters would be decoded by UTF-8. Maybe you can look up what encoding your operating system uses. Even in the worst case, you can use the class ImageData to open images from memory instead of the file path.