我已经在我的墨盒(Python 2.7)中成功安装了 PIL 和 reportlab,并通过控制台中的 ssh 对它们进行了测试。
不知何故,reportlab 无法使用 PIL。
我也尝试下载 PIL 并修复 64 位问题,但我继续收到错误消息。
这是我得到的消息:
unpack requires a string argument of length 1
Imaging Library not available, unable to import bitmaps only jpegs
fileName='/var/lib/openshift/52c1ab8de0b8cdb8a1000177/app-root/runtime/repo/wsgi/static/images/logo_colegio.png' identity=[ImageReader@0x7f6206c29c10 filename='/var/lib/openshift/52c1ab8de0b8cdb8a1000177/app-root/runtime/repo/wsgi/static/images/logo_colegio.png']
fileName='/var/lib/openshift/52c1ab8de0b8cdb8a1000177/app-root/runtime/repo/wsgi/static/images/logo_colegio.png' identity=[ImageReader@0x7f6206c29c10 filename='/var/lib/openshift/52c1ab8de0b8cdb8a1000177/app-root/runtime/repo/wsgi/static/images/logo_colegio.png']
我查看了代码,发现这是应该抛出异常的地方:
if haveImages:
#detect which library we are using and open the image
if not self._image:
self._image = self._read_image(self.fp)
if getattr(self._image,'format',None)=='JPEG':
self.jpeg_fh = self._jpeg_fh
else:
from reportlab.pdfbase.pdfutils import readJPEGInfo
try:
self._width,self._height,c=readJPEGInfo(self.fp)
except:
annotateException('\nImaging Library not available, unable to import
bitmaps only jpegs\nfileName=%r identity=%s'%(fileName, self.identity()))
它应该只在“haveImages”为 False 时引发。奇怪的是,我使用控制台打印 reportlab.util.haveImage 并得到“真”
我的想法不多了...有没有人遇到过这样的情况?任何想法将不胜感激!
PD:当我尝试使用 addFromList() ((Platypus)) 将图像添加到框架时会发生这种情况