[XML-SIG] really weird pxdom error

Malcolm Tredinnick malcolm at commsecure.com.au
Wed Sep 1 10:11:56 CEST 2004


On Wed, 2004-09-01 at 17:30 +1000, Ajay wrote:
> hi!
> 
> i have an xml file - basedataschema.xml
> 
> when i call, p = pxdom.parse("proxy\basedataschema.xml")
> 
> i get the error
> 
> >>> p = pxdom.parse("proxy_pxdom_xpath\basedataschema.xml")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "c:\Python23\lib\site-packages\pxdom.py", line 4385, in parse
>     doc= parser.parse(src)
>   File "c:\Python23\lib\site-packages\pxdom.py", line 3161, in parse
>     self.pxdomParseBefore(input, document, None)
>   File "c:\Python23\lib\site-packages\pxdom.py", line 3256, in
> pxdomParseBefore
>     self._buffer= InputBuffer(input, (1, 1), self._domConfig, True)
>   File "c:\Python23\lib\site-packages\pxdom.py", line 2993, in __init__
>     self.config._handleError(IOErrorErr(e))
>   File "c:\Python23\lib\site-packages\pxdom.py", line 722, in _handleError
>     raise error
> pxdom.IOErrorErr: pxdom could not read resource: [Errno 2] No such file or
> direc
> tory: 'C:\\hons\\prototype\\proxy_pxdom_xpath\x08asedataschema.xml'
> 
> first of all i cant understand where it gets the name x08asedataschema.xml
> secondly if i change into the directory where the schema is and then
> execute, p = pxdom.parse("basedataschema.xml") it works perfectly fine.

The Python interpreter is interpreting the backslashes before it gets
passed to pxdom.parse(). In particular, '\b' is seen to be the backspace
character (ASCII code 8) and treated as such.

You need to pass in "proxy_pxdom_xpath\\basedataschema.xml" or use raw
strings: r"proxy_pxdom_xpath\basedataschema.xml"

Cheers,
Malcolm




More information about the XML-SIG mailing list