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

TypeError: unsupported operand type(s) for +: 'int' and 'str' #30

Closed
fjgonzalezm opened this issue Nov 27, 2013 · 6 comments
Closed

TypeError: unsupported operand type(s) for +: 'int' and 'str' #30

fjgonzalezm opened this issue Nov 27, 2013 · 6 comments
Labels

Comments

@fjgonzalezm
Copy link

I was processing a large list of image files and I was getting the error 'TypeError: unsupported operand type(s) for +: 'int' and 'str''. This is the complete output:

Opening: /Users/familypc/Desktop/culprit.jpg
Traceback (most recent call last):
  File "./EXIF.py", line 132, in <module>
    main()
  File "./EXIF.py", line 100, in main
    data = process_file(file, stop_tag=stop_tag, details=detailed, strict=strict, debug=debug)
  File "/private/tmp/exif-py/exifread/__init__.py", line 201, in process_file
    hdr.dump_IFD(exif_off.values[0], 'EXIF', stop_tag=stop_tag)
  File "/private/tmp/exif-py/exifread/classes.py", line 124, in dump_IFD
    entries = self.s2n(ifd, 2)
  File "/private/tmp/exif-py/exifread/classes.py", line 71, in s2n
    self.file.seek(self.offset + offset)
TypeError: unsupported operand type(s) for +: 'int' and 'str'

I was able to track the issue to a particular file:
culprit

That file was an Photoshop export from a Nikon RAW image (*.nef) to jpg. I don't know what's wrong with it. I have other files exported the same way and I didn't have issues. The files is perfectly fine because I can open it.

@altendky
Copy link

altendky commented Mar 2, 2014

My gut says this is related to issue #33 which I just submitted. After finding my issue I looked here and was able to recreate this issue with the example image above.

altendky@lt:~/ex$ git --git-dir=/tmp/exif-py/.git pull
Already up-to-date.
altendky@lt:~/ex$ git --git-dir=/tmp/exif-py/.git rev-parse HEAD
bce80b49d1b9ac7a178e6cae19416ba3712109f5
altendky@lt:~/ex$ python3
Python 3.3.2+ (default, Oct  9 2013, 14:50:09) 
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import exifread
>>> exifread.__version__
'2.0.0'
>>> f = open('ex2.jpg', 'rb')
>>> tags = exifread.process_file(f)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.3/dist-packages/ExifRead-2.0.0-py3.3.egg/exifread/__init__.py", line 209, in process_file
    hdr.dump_ifd(exif_off.values[0], 'EXIF', stop_tag=stop_tag)
  File "/usr/local/lib/python3.3/dist-packages/ExifRead-2.0.0-py3.3.egg/exifread/classes.py", line 120, in dump_ifd
    entries = self.s2n(ifd, 2)
  File "/usr/local/lib/python3.3/dist-packages/ExifRead-2.0.0-py3.3.egg/exifread/classes.py", line 72, in s2n
    self.file.seek(self.offset + offset)
TypeError: unsupported operand type(s) for +: 'int' and 'str'

@ianare
Copy link
Owner

ianare commented Mar 3, 2014

@fjgonzalezm , would you allow this image to be added to the sample images repo for testing?

https://github.com/ianare/exif-samples

TIA,

ianaré

@fjgonzalezm
Copy link
Author

Yes sure you my consent to use the image

@ianare
Copy link
Owner

ianare commented Mar 4, 2014

OK thank you

@Christophe31
Copy link

unrelated, I saw @altendky used python3, souldn't you update your setup.py classifier accordingly?

caniusepython3.com said me you don't support python3.

ianare added a commit that referenced this issue Nov 18, 2014
@ianare
Copy link
Owner

ianare commented Nov 18, 2014

Should be fixed now (sorry for the wait).

@ianare ianare closed this as completed Nov 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants