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

Roger Whittaker roger at disruptive.org.uk
Mon May 16 10:17:22 EDT 2011


On Mon, May 16, 2011 at 10:06:56AM +0100, Roger Whittaker wrote:


> I'll make the simplest possible test case where I see the problem

> and post it here later today if possible.


$ cat process.py
#! /usr/bin/env python
from sys import argv
from pyRXP import Parser
infile = open(argv[1], 'r').read()
p = Parser()
parsed = p.parse(infile)

$ cat foo.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE test SYSTEM "./test.dtd"[
<!ENTITY a SYSTEM "./first-file.xml">
<!ENTITY b SYSTEM "./second-longer-file.xml">
]>

<test>
<document>
&a;
&b;
</document>
</test>

$ cat test.dtd
<!ELEMENT test (document) >
<!ELEMENT document (para)* >
<!ELEMENT para (#PCDATA) >

$ cat first-file.xml
<para>
test text
</para>

$ cat second-longer-file.xml
<para>
test text
</para>

roger at snark: /tmp/abcd $ ./process.py foo.xml
/tmp/abcd/secondonger-fifile.xml: No such file or directory
Traceback (most recent call last):
File "./process.py", line 6, in <module>
parsed = p.parse(infile)
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!

But whether we see the errors (and what exact error we see - how
the file name gets garbled) depends on the full path to the
directory we're in.

So - with the same files:

roger at snark: /tmp/a $ ./process.py foo.xml
[no error]

roger at snark: /tmp/abcdefg $ ./process.py foo.xml
/tmp/abcdefg/secd-longer-fifile.xml: No such file or directory
Traceback (most recent call last):
File "./process.py", line 6, in <module>
parsed = p.parse(infile)
pyRXP.error: Error: Couldn't open entity b, file:///tmp/abcdefg/secd-longer-fifile.xml
in unnamed entity at line 10 char 8 of [unknown]
Couldn't open entity b, file:///tmp/abcdefg/secd-longer-fifile.xml
Parse Failed!

It seems to be the total length of the full path that makes he
difference - e.g. the above error looks the same here:

roger at snark: /tmp/jjjjjjj $ ./process.py foo.xml
/tmp/jjjjjjj/secd-longer-fifile.xml: No such file or directory
Traceback (most recent call last):
File "./process.py", line 6, in <module>
parsed = p.parse(infile)
pyRXP.error: Error: Couldn't open entity b, file:///tmp/jjjjjjj/secd-longer-fifile.xml
in unnamed entity at line 10 char 8 of [unknown]
Couldn't open entity b, file:///tmp/jjjjjjj/secd-longer-fifile.xml
Parse Failed!



--
========================
Roger Whittaker
roger at disruptive.org.uk
http://disruptive.org.uk
========================


More information about the reportlab-users mailing list