[reportlab-users] Wordaxe 0.3.0, ReportLab 2.2: Assertion Failure, cannot understand why this has to be asserted...

Robin Becker robin at reportlab.com
Mon Feb 16 12:50:34 EST 2009


Harald Armin Massa wrote:

> hello,

>

> 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

> 5 SP( ) 2.224

> 6 SW(die) 10.672

> 7 SP( ) 2.224

> 8 SW(der) 11.56

> 9 SP( ) 2.224

> 10 SW(Versicherungsnehmer,) 80.472

> 11 SP( ) 2.224

> 12 SW(ein) 10.672

> 13 SP( ) 2.224

> 14 SW(Mitversicherter) 52.448

> 15 SP( ) 2.224

> 16 SW(oder) 16.008

> 17 SP( ) 2.224

> 18 SW(eine) 15.12

> 19 SP( ) 2.224

> 20 SW(von) 12.896

> 21 SP( ) 2.224

> 22 SW(ihnen) 19.568

> 23 SP( ) 2.224

> 24 SW(bestellte) 29.792

> 25 SP( ) 2.224

> 26 SW(oder) 16.008

> 27 SP( ) 2.224

> 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?

>

> best wishes

>

> Harald

>


I believe there was some awful hackery around reconstructing texts when
paragraphs get split. Even when the new paragraph was supposed to fit it
sometimes didn't because of slight differences in accumulation errors etc etc.

The above looks like a sanity check for seeing if the current set of fragments
actually fits on the line.

However, since that code isn't currently part of our paragraph I can't be
totally sure.
--
Robin Becker


More information about the reportlab-users mailing list