Closed Bug 627476 Opened 13 years ago Closed 13 years ago

IOError: No such file or directory when deleting image before generate_thumbnail gets to it

Categories

(support.mozilla.org :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 624427
2011Q1

People

(Reporter: paulc, Unassigned)

Details

(Whiteboard: [gallery])

I was able to repro this consistently locally, and I think fixing it would help reduce our stack trace emails.

That said, not fixing it doesn't harm us except for the extra noise of having generate_thumbnail() being called for already-deleted images.

Code:
 def generate_thumbnail(for_obj, from_field, to_field,
 ...
     from_ = getattr(for_obj, from_field)
+    if not from_:
+        return
 ...


FWIW, the stack trace looks like this:

Task upload.tasks.generate_thumbnail with id 13a56115-94b3-4b83-9114-ee1af3=
b260f2 raised exception:
"IOError(2, 'No such file or directory')"


Task was called with args: (<ImageAttachment: uploads/images/2011-01-20-11-=
58-52-753661.png>, 'file', 'thumbnail') kwargs: {}.

The contents of the full traceback was:

Traceback (most recent call last):
  File "/Users/paulc/Sites/kitsune/vendor/packages/celery/celery/execute/tr=
ace.py", line 34, in trace
    return cls(states.SUCCESS, retval=3Dfun(*args, **kwargs))
  File "/Users/paulc/Sites/kitsune/vendor/packages/celery/celery/task/base.=
py", line 248, in __call__
    return self.run(*args, **kwargs)
  File "/Users/paulc/Sites/kitsune/vendor/packages/celery/celery/decorators=
.py", line 52, in run
    return fun(*args, **kwargs)
  File "/Users/paulc/Sites/kitsune/apps/upload/tasks.py", line 27, in gener=
ate_thumbnail
    thumb_content =3D _create_image_thumbnail(from_.path, longest_side=3Dma=
x_size)
  File "/Users/paulc/Sites/kitsune/apps/upload/tasks.py", line 35, in _crea=
te_image_thumbnail
    originalImage =3D Image.open(file_path)
  File "/Users/paulc/.virtualenvs/kitsune/lib/python2.6/site-packages/PIL/I=
mage.py", line 1952, in open
    fp =3D __builtin__.open(fp, "rb")
IOError: [Errno 2] No such file or directory
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
Whiteboard: [gallery]
You need to log in before you can comment on or make changes to this bug.