Re: [PythonReports-users] Images
Brought to you by:
a1s
|
From: Werner F. B. <wer...@fr...> - 2013-02-11 07:52:33
|
On 11/02/2013 07:49, alexander smishlajev wrote:
> 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)" />
Sorry, to confuse you, the file contains:
<image type="png">
<box height="30" width="75" x="374" y="50" />
<data> expr="ru.getRecipeImagePNG(THIS.id)"</data>
</image>
When I run it through the debugger (WingIDE) I see at line 92 of fromdata in PILDrivers that the
param "data" contains:
u'expr="ru.getRecipeImagePNG(THIS.id)"'
As if the expression has never been evaluated (correct term), i.e. my getRecipeImagePNG method is never called.
Werner
|