[reportlab-users] pyRXP - strange non-deterministic errors on python 2.7 and 64-bit Linux

Robin Becker robin at reportlab.com
Mon May 16 10:46:29 EDT 2011

On 16/05/2011 15:27, Roger Whittaker wrote:

> On Mon, May 16, 2011 at 10:01:26AM +0100, Robin Becker wrote:


>> Another approach might be to try passing an entity opening callback

>> into the parser that could be used to try and see what information

>> is being parsed to obtain the entity.


> Using your code


> $ cat withcallback.py

> #! /usr/bin/env python

> from pyRXP import Parser

> infile = open(argv[1], 'r').read()

> p = Parser()

> def eoCB(entity):

> print 'eoCB(%r)' % entity

> return entity

> parsed = p.parse(infile,eoCB=eoCB)


> roger at snark: /tmp/abcd $ ./withcallback.py foo.xml

> eoCB('./test.dtd')

> eoCB('./first-file.xml')

> eoCB('./second-longer-file.xml')

> /tmp/abcd/secondonger-fifile.xml: No such file or directory

> Traceback (most recent call last):

> File "./withcallback.py", line 9, in<module>

> parsed = p.parse(infile,eoCB=eoCB)

> pyRXP.error: Error: Couldn't open entity b, file:///tmp/abcd/secondonger-fifile.xml

> in unnamed entity at line 10 char 8 of [unknown]

> Couldn't open entity b, file:///tmp/abcd/secondonger-fifile.xml

> Parse Failed!



So we're being passed a normal 8 bit string that looks right and return that to
the entity opening code in rxp and that appears to fall down with a messed up
filename. At first site it almost looks like stuff is being written in a strange
way ie we have a mix of bits from first-file.xml & second-longer-file.xml.

Can you say exactly which version of ubuntu is being used? I'll need to make up
an equivalent virtual machine to make any sense of this. I can do x64, but have
no spare machine for a full install. I guess we are fixed on python 2.7 and some
version of gcc, but if that's not standard with the install I'll need to upgrade
etc etc.
Robin Becker

More information about the reportlab-users mailing list