Skip to content
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

IdfTag.__str__() returns a list #142

Open
cornellwrightjr opened this issue Mar 16, 2021 · 0 comments
Open

IdfTag.__str__() returns a list #142

cornellwrightjr opened this issue Mar 16, 2021 · 0 comments

Comments

@cornellwrightjr
Copy link

With a certain .jpg file,the str method of IdfTag returns a list of values. This causes an exception when I attempt to print the value of an EXIF tag. A short recreation program is attached along with the .jpg file causing the problem.

I can work around this problem very easily by replacing str(value) with str(value.str()), so nothing urgent from my point of view. Additionally, I'd be happy to have a go at providing a fix if you would be interested in taking it. I suspect the problem is in the bottom of the _process_tag method in classes.py after the comment <# compute printable version of values>.

This occurred on MacOS 11.2.3 running ExifRead 2.9.2 installed via pip and Python 3.9.2 installed via homebrew.

Here's the output from the recreation program showing the problem.

====> val.str() returns non-string <====
tag: MakerNote SpecialMode
type(val): <class 'exifread.classes.IfdTag'>
val.str(): [2290028546, 2317605138, 3584621556]
type(val.str()): <class 'list'>
len(val.str()) 3
val.str()[0] 2290028546
val.str()[1] 2317605138
val.str()[2] 3584621556
tag: MakerNote SpecialMode val: Traceback (most recent call last):
File "/Users/cornell/shr/pgm/jpeg-date-name/./bug-demo.py", line 21, in
print('tag:', tag, 'val:', val)
TypeError: str returned non-string (type list)
bug-demo.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant