PIL打开JPEG缺少Photoshop

时间:2019-06-26 20:20:47

标签: python python-imaging-library jpeg

我正在使用Pillow / PillowPIL打开jpg文件。但是正在收到一个丢失的photoshop错误。

环境是可移植的python WinPython-64bit-2.7.13.1Zero基本安装,以及Pillow-PIL和其他一些安装的软件包。

>>> from PIL import Image
>>> Image.open("snap_thm_0.jpg")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\you\Desktop\penvgui\lib\site-packages\PIL\Image.py", line 2690, in open
    im = _open_core(fp, filename, prefix)
  File "C:\Users\you\Desktop\penvgui\lib\site-packages\PIL\Image.py", line 2676, in _open_core
    im = factory(fp, filename)
  File "C:\Users\you\Desktop\penvgui\lib\site-packages\PIL\JpegImagePlugin.py", line 783, in jpeg_factory
    im = JpegImageFile(fp, filename)
  File "C:\Users\you\Desktop\penvgui\lib\site-packages\PIL\ImageFile.py", line 103, in __init__
    self._open()
  File "C:\Users\you\Desktop\penvgui\lib\site-packages\PIL\JpegImagePlugin.py", line 373, in _open
    handler(self, i)
  File "C:\Users\you\Desktop\penvgui\lib\site-packages\PIL\JpegImagePlugin.py", line 139, in APP
    self.info["photoshop"] = photoshop
UnboundLocalError: local variable 'photoshop' referenced before assignment
>>>

是否需要其他软件包来解决此问题?谢谢。

1 个答案:

答案 0 :(得分:-1)

如评论所示,furas提供的临时解决方法是分配一个None代替photoshop。