[reportlab-users] Problem adding image

Henning von Bargen H.vonBargen at t-p.com
Fri Apr 27 02:35:48 EDT 2007




> From: "Jim Steil" <jim at qlf.com>

> Subject: [reportlab-users] Problem adding image

>

> Hi:

>

> I'm having trouble getting an image to consistently display

> on a report

> I'm generating. Below are two images. They are both generated using

> the EXACT same program. One time I called it and the brown-ish image

> shows up. Then when I immediately call it again, the image

> doesn't show

> up. This doesn't happen with any predictable regularity.

> Sometimes the

> image is displayed, and sometimes it isn't. It doesn't matter which

> order I run it, I can't find any pattern to why it sometime

> displays the

> image and others, it doesn't. To summarize how I'm building

> this, this

> is what I'm doing:

>

> 1. Create a table with 2 rows, 1 column and set the heights,

> backgrounds, borders, etc.

> 2. Inside, build a drawing using the following code:

>

> binDrawing = Drawing(60, 60)

>

> binDrawing.add(Rect(19.0,40,60,binDrawHeight,fillColor=colors.white))

>

> if bobStatus == 0:

>

>

> binDrawing.add(Image(19.6,40.55,58.85,binLevelHeight,'%s/brown.jpg' %

> (imagePath)))

>

> 3. Inside the table cell, add the heading and the drawing. The

> listData is the table data that I'm modifying, I create it in a prior

> step and I just 'update' the data here.

>

> listData[headerRow[currentCell]][headerCol[currentCell]] =

> binHeader

>

> listData[drawingRow[currentCell]][drawingCol[currentCell]] =

> binDrawing

>

> I'm really confused as to why it will work sometimes but not others.

> I've done all kinds of verification to know that it IS definitely

> finding the image. I've made sure that it isn't a layering

> issue, that

> the image exists but is behind the Rectangle that I've added.

>

> Is there anyone that has mastered the Graphics package run

> into anything

> like this before? Any clues as to where I can go to figure

> out what is

> causing this? Any responses would be appreciated. I'm happy to post

> more code if you think it would help.

>


I think you should try to narrow it down to a simple, working
example program (using fiexed data).
I suspect that there are some side-effects that influence your
current program (without having seen it).
For example, is your program multi-threaded? Or is there an error
at the OS level that is silently ignored by your program?
I cannot imagine the same program with the same data in the same
environment/situation to behave differently.

Henning


More information about the reportlab-users mailing list