[reportlab-users] Naked ampersand

Robin Becker robin at reportlab.com
Tue Sep 14 07:10:18 EDT 2010


On 13/09/2010 11:47, Paul Keating wrote:

> I ran the test suite on the newly installed 64-bit version (revision 3520) and ran into a snag that I had hit earlier with my own integration testing: platypus.paragraph.Paragraph() chokes on a text string with& in it:

>

> ERROR: testNakedAmpersands (test_platypus_paraparser.ParaParserTestCase)

> ----------------------------------------------------------------------

> Traceback (most recent call last):

> File "C:\Python26\Lib\site-packages\reportlab\tests\test_platypus_paraparser.py", line 115, in testNakedAmpersands

> p = Paragraph(txt, self.style)

> File "c:\python26\lib\site-packages\reportlab\platypus\paragraph.py", line 805, in __init__

> self._setup(text, style, bulletText, frags, cleanBlockQuotedText)

> File "c:\python26\lib\site-packages\reportlab\platypus\paragraph.py", line 823, in _setup

> % (_parser.errors[0],text[:min(30,len(text))]))

> ValueError: xml parser error (bogus< or&) in paragraph beginning '1& 2'

>

..........

OK I have downloaded and installed

http://www.reportlab.com/ftp/reportlab-daily.win-amd64-py2.6.exe

in my win xp 64 bit vm.

I had to manually obtain the tests from svn, but these all pass if I have also
installed PIL from here

http://www.mediafire.com/?20h3zeimnke

not sure who built that, but it seems genuine and my clamwin doesn't whine about
it. I tested test_platypus_paraparser.py explicitly and it doesn't complain.

However, if I remove the sgmlop.pyd from site packages, then the above error
does occur. I think that's because we then fall back to
reportlab.lib.xmllib.SlowParser which is more picky. I suppose that's a bug, but
it is called xmllib and I'm farly sure that the modern python supported versions
are probably even more pedantic.
--
Robin Becker


More information about the reportlab-users mailing list