[reportlab-users] Wordaxe 0.3.0, ReportLab 2.2: Assertion Failure, cannot understand why...
Henning von Bargen
H.vonBargen at t-p.com
Tue Feb 17 04:46:20 EST 2009
Harald Armin Massa wrote:
> while running a document in preparation for updating wordaxe /
> reportlab, I get the Assertion failure:
>
> Assertion failure
> self.width=429.536000
> nFrags=31
> printrange=0:31
> printwidth=431.760000
> 0 SW() 0
> 1 SP( ) 2.224
> 2 SW(wegen) 23.568
> 3 SP( ) 2.224
> 4 SW(Sch?den,) 33.8
...
> 28 SW(beauftragte) 40.472
> 29 SP( ) 2.224
> 30 SW(Person) 25.344
>
> asserted was:
>
> if not abs(self.width - sum(getattr(f,"width",0) for f in
> fragments[print_indx_start:print_indx_end])) <= 1e-5:
>
> and I a have no Idea WHY this get's asserted. My "first look"
> understanding is that this is checking that floating point errors stay
> below some point, but... what is the bigger idea behind this?
Harald,
the code you are mentioning is part of wordaxe, not ReportLab.
Please file a bug for wordaxe instead of posting to this list next time.
But to answer your question:
There's no bigger idea. The intention is just as you guessed:
When I coded NewParagraph, I assumed that the sum of the fragments' widths
should match self.width - since floats are used, the comparison is a bit fuzzy.
This is to assure that the paragraph doesn't "write across its border" when
finally it will be rendered.
Seems like either there's a bug in the wordaxe code or the assertion is wrong.
You may try to comment the assertion and carefully look at the generated PDF
for this paragraph.
Henning
More information about the reportlab-users
mailing list