0

I am trying to use easy_thumbnails in a Django (1.5) project on my laptop (OSX Lion) using the local django development server (runserver) or a python shell. I have the PIL library installed with jpeg support and I am working in a virtual environment. I am testing the easy_thumbnail app in a django shell with the following command:

th = get_thumbnailer(mymodel.image)
th.get_thumbnail(options)

These commands work fine on the server, the thumbnail is created successfully. However, in my local django shell and when using runserver the same command leads to the following error:

File "/.../site-packages/easy_thumbnails/files.py", line 397, in get_thumbnail
  thumbnail = self.generate_thumbnail(thumbnail_options)
File "/.../site-packages/easy_thumbnails/files.py", line 293, in generate_thumbnail
  "The source file does not appear to be an image")
InvalidImageFormatError: The source file does not appear to be an image

The Python Imaging library works well on my computer. In a normal (non-django) python shell, I can read, verify and write jpeg images.

I have tried many different ways of working around this problem, as I am aware that this could potentially be a problem of library pahts, as suggested in this question. I am out of ideas what I could try to solve this problem, any hints would be greatly appreciated.

Community
  • 1
  • 1
yellowcap
  • 3,985
  • 38
  • 51
  • try to use PILLOW instead of PIL – catherine Mar 20 '13 at 02:21
  • Thanks @catherine I tried that too, but it did not help. Now I am wondering if it might be a permissions problem when trying to creating a thumbnail file upon calling `get_thumbnail`. Maybe the runserver environment fails to write the new thumbnail image on the server... – yellowcap Mar 22 '13 at 15:30
  • Actually, I just realized that the same command works fine locally, if the thumbnail was previously created on the server by using `get_thumbnail` there. – yellowcap Mar 22 '13 at 15:40

0 Answers0