0

我正在尝试使用本地 django 开发服务器 ( ) 或 python shell在我的笔记本电脑 (OSX Lion) 上easy_thumbnails的项目中使用。我安装了支持 jpeg 的库,并且我在虚拟环境中工作。我正在使用以下命令在 django shell 中测试应用程序:Django (1.5)runserverPILeasy_thumbnail

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

这些命令在服务器上工作正常,缩略图创建成功。但是,在我的本地 django shell 和使用 runserver 时,相同的命令会导致以下错误:

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

Python Imaging 库在我的计算机上运行良好。在普通(非 django)python shell 中,我可以读取、验证和写入 jpeg 图像。

我已经尝试了许多不同的方法来解决这个问题,因为我知道这可能是库路径的问题,正如这个问题中所建议的那样。我不知道我可以尝试解决这个问题,任何提示将不胜感激。

4

0 回答 0