Re: [PythonReports-users] Images
Brought to you by:
a1s
From: alexander s. <al...@go...> - 2013-02-11 07:32:51
|
On 10.02.2013 22:10, Werner F. Bruhin wrote: > > buf= StringIO.StringIO() > img.save(buf, format= 'PNG') > temp = buf.getvalue() > return temp This should be Ok. > The image element is: > > <image type="png"> > <box height="30" width="75" x="374" y="50" /> > <data> expr="ru.getRecipeImagePNG(THIS.id)"</data> > </image> > > But I get this traceback: > File "c:\Python27\Lib\site-packages\PythonReports\PILDrivers.py", line > 92, in fromdata > _rv._image = Image.open(StringIO(data)) > File "c:\Python27\Lib\site-packages\PIL\Image.py", line 1980, in open > raise IOError("cannot identify image file") > > And "data" in fromdata at line 92 is my expression string instead of the > image data, as if the expression is never "run". > > data > u'expr="ru.getRecipeImagePNG(THIS.id)"' But of course! Try <data expr="ru.getRecipeImagePNG(THIS.id)" /> Best wishes, alex. |