[reportlab-users] init Image from cStringIO

Ulrich Wisser reportlab-users@reportlab.com
Fri, 30 Apr 2004 13:45:33 +0200


Hi,

could not find an example on the website or in the faq, not even in the 
list archive (although I believe it has already been asked).

I use gdchart to create a chart in memory. Now I want to include it in 
my PDF. Here is my code

     graphfile = cStringIO.StringIO()
     apply(gdchart.chart, (gdchart.GDC_3DBAR, 
(int(document.pagesize[0]/2 - 4.5*cm),250), graphfile) + 
tuple((graphlabel, graphdata)))

     graphfile.seek(0)
     graph=Image(graphfile)

Only I get an error message

    IOError: [Errno 2] No such file or directory: '<StringO object at 
0x9714098>'

Any ideas? How can I include that image in my PDF?

Thanks

Ulrich