This forum is now just an archive. Use the new Q&A website
It is currently Fri Apr 18, 2014 5:38 pm

All times are UTC + 2 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Image in report header causes error in reportlab _isPILImage
PostPosted: Wed Sep 15, 2010 8:47 pm 
Offline

Joined: Fri Jul 30, 2010 5:27 pm
Posts: 3
Hello!

I'm having a problem with rendering of the report header since I added a company logo. The traceback is this:

Code:
Traceback (most recent call last):
  File "/usr/share/pyshared/openerp-server/service/web_services.py", line 688, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/usr/share/pyshared/openerp-server/report/report_sxw.py", line 365, in create
    fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
  File "/usr/share/pyshared/openerp-server/report/report_sxw.py", line 396, in create_source_pdf
    result = self.create_single_pdf(cr, uid, [obj.id], data, report_xml, context)
  File "/usr/share/pyshared/openerp-server/report/report_sxw.py", line 448, in create_single_pdf
    pdf = create_doc(etree.tostring(processed_rml),rml_parser.localcontext,logo,title.encode('utf8'))
  File "/usr/share/pyshared/openerp-server/report/interface.py", line 183, in create_pdf
    obj.render()
  File "/usr/share/pyshared/openerp-server/report/render/render.py", line 50, in render
    result = self._render()
  File "/usr/share/pyshared/openerp-server/report/render/rml.py", line 41, in _render
    return rml2pdf.parseNode(self.rml, self.localcontext, images=self.bin_datas, path=self.path,title=self.title)
  File "/usr/share/pyshared/openerp-server/report/render/rml2pdf/trml2pdf.py", line 791, in parseNode
    r.render(fp)
  File "/usr/share/pyshared/openerp-server/report/render/rml2pdf/trml2pdf.py", line 205, in render
    pt_obj.render(el)
  File "/usr/share/pyshared/openerp-server/report/render/rml2pdf/trml2pdf.py", line 785, in render
    self.doc_tmpl.build(fis)
  File "/usr/lib/python2.6/dist-packages/reportlab/platypus/doctemplate.py", line 874, in build
    self.clean_hanging()
  File "/usr/lib/python2.6/dist-packages/reportlab/platypus/doctemplate.py", line 509, in clean_hanging
    self.handle_flowable(self._hanging)
  File "/usr/lib/python2.6/dist-packages/reportlab/platypus/doctemplate.py", line 756, in handle_flowable
    f.apply(self)
  File "/usr/lib/python2.6/dist-packages/reportlab/platypus/doctemplate.py", line 140, in apply
    getattr(doc,arn)(*args)
  File "/usr/lib/python2.6/dist-packages/reportlab/platypus/doctemplate.py", line 534, in handle_pageBegin
    self.pageTemplate.onPage(self.canv,self)
  File "/usr/share/pyshared/openerp-server/report/render/rml2pdf/trml2pdf.py", line 448, in render
    cnv.render(self.node)
  File "/usr/share/pyshared/openerp-server/report/render/rml2pdf/trml2pdf.py", line 433, in render
    tags[n.tag](n)
  File "/usr/share/pyshared/openerp-server/report/render/rml2pdf/trml2pdf.py", line 367, in _image
    img = ImageReader(s)
  File "/usr/lib/python2.6/dist-packages/reportlab/lib/utils.py", line 540, in __init__
    if _isPILImage(fileName):
  File "/usr/lib/python2.6/dist-packages/reportlab/lib/utils.py", line 521, in _isPILImage
    return isinstance(im,Image.Image)
AttributeError: 'NoneType' object has no attribute 'Image'


It doesn't make any difference whether I let it use the [[company.logo]] field in the image tag, or try to hardcode the image with file=/foo or whether I use png, gif, jpg etc...always I get this error until I remove the image.

The image file is definitely being found because if I point it to an non-existent file the error is something different and I see as expected an error looking for it in apache log. So it seems to be a problem with python/reportlab rendering the image.

Originally I was using server version 5.0.6 from Ubuntu Lucid standard packages, though I upgraded it now to server 5.0.14 in Maverick beta, but the error is still the same.

In openerp-server.log I do not see any extra information, only the same trace dump. Not knowing Python very well, I'm really at a loss as to what might be causing this, so any help at all would be greatly appreciated.

Thanks in advance!
-Will


Top
 Profile  
 
 Post subject: Re: Image in report header causes error in reportlab _isPILI
PostPosted: Thu Oct 07, 2010 9:49 am 
Offline

Joined: Wed Oct 28, 2009 10:48 pm
Posts: 44
Did you find any solution?

I have the same error with a Windows Server.


Top
 Profile  
 
 Post subject: Re: Image in report header causes error in reportlab _isPILI
PostPosted: Thu Oct 07, 2010 10:23 am 
Offline

Joined: Wed Oct 28, 2009 10:48 pm
Posts: 44
I install Python Imaging Library and restart server.
It works :)

http://www.pythonware.com/products/pil/


Top
 Profile  
 
 Post subject: Re: Image in report header causes error in reportlab _isPILI
PostPosted: Thu Oct 07, 2010 12:34 pm 
Offline

Joined: Fri Jul 30, 2010 5:27 pm
Posts: 3
Laurent0 wrote:
I install Python Imaging Library and restart server.
It works :)

http://www.pythonware.com/products/pil/


Excellent, that solves the problem, thank you!

For Debian/Ubuntu users the package is python-imaging. I've logged a bug in Launchpad to add the depends for openerp-server package.

I guessed it must be something like that but hadn't found "python imaging" in my search before (probably only searched something like "apt-cache search python | grep image").

Thanks for the help Laurent! :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP