shotvibe / shotvibe-web

ShotVibe REST API webservice
1 stars 0 forks source link

Error when calling img._getexif() #14

Closed benny-shotvibe closed 11 years ago

benny-shotvibe commented 11 years ago

Take a look at the following stacktrace. Seems that _getexif might not always be available (maybe if there is no exif data, or perhaps if the file is not a jpeg)

Internal Server Error: /albums/273/
Traceback (most recent call last):
  File "/srv/shotvibe_web/1371649006/.venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 115, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/srv/shotvibe_web/1371649006/.venv/local/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/srv/shotvibe_web/1371649006/.venv/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 77, in wrapped_view
    return view_func(*args, **kwargs)
  File "./photos_api/check_modified.py", line 136, in dispatch
    response = self.handle_exception(exc)
  File "./photos_api/check_modified.py", line 129, in dispatch
    response = handler(request, *args, **kwargs)
  File "./photos_api/views.py", line 96, in post
    self.album.add_photos(request.user, serializer.object.add_photos)
  File "./photos/models.py", line 78, in add_photos
    Photo.objects.upload_to_album(photo_id, self, now)
  File "./photos/models.py", line 130, in upload_to_album
    width, height = image_uploads.process_uploaded_image(pending_photo.bucket, photo_id)
  File "./photos/image_uploads.py", line 202, in process_uploaded_image
    img = load_image_correct_orientation(img_file_path)
  File "./photos/image_uploads.py", line 149, in load_image_correct_orientation
    orientation_value = get_tag_value(img._getexif(), 'Orientation')
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 512, in __getattr__
    raise AttributeError(name)
AttributeError: _getexif
benny-shotvibe commented 11 years ago

This is fixed in d5e06f470934f68616fc7cd2751915798b184b01