Odoo云服务器上传jpg图片提示IOError错误
 
 
  File "/usr/lib64/python2.7/site-packages/PIL/ImageFile.py", line 200, in load
    d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 417, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
初步判断是python pil库依赖的底层jpeg lib问题
但是本机正常无法重现,于是检查环境
 
 
 
[srj@x1c ~]$ yum list installed|grep jpeg
libjpeg-turbo.x86_64               1.2.90-5.el7                        @anaconda
libjpeg-turbo-devel.x86_64         1.2.90-5.el7                        @anaconda
openjpeg-libs.x86_64               1.5.1-10.el7                        @anaconda
对比了下发现服务器环境没有libjpeg-turbo-devel.x86_64立马补装一个,重启odoo服务错误依旧,于是继续更新Pillow库
 
 
 
[root@demo ~]# pip install --upgrade Pillow
Collecting Pillow
  Downloading Pillow-3.1.0.tar.gz (9.9MB)
    100% |████████████████████████████████| 9.9MB 42kB/s 
Installing collected packages: Pillow
  Found existing installation: Pillow 2.7.0
    Uninstalling Pillow-2.7.0:
      Successfully uninstalled Pillow-2.7.0
  Running setup.py install for Pillow
Successfully installed Pillow-3.1.0
重启odoo服务问题解决
最后回顾了下odoo requirements.txt:
odoo8 Pillow==2.5.1
odoo9 Pillow==2.7.0
其实所谓更新无非是重新安装编译一下Pillow库,没想到直接升级到3.1.0版本,希望没有什么副作用:)