reloading a network resource fails

Bug #128664 reported by Holger Joukl on 2007-07-27
2
Affects Status Importance Assigned to Milestone
lxml
Status tracked in Trunk
Trunk
Medium
scoder

Bug Description

Hi,
parsing from a network resource works only once in lxml trunk.
If you try to repeat that operation, it fails for all subsequent
attempts:

*** 2.0.dev-45372 ***
>>> etree.parse("http://adevp01:8080/validSummary-1.2.xml")
<etree._ElementTree object at 0x2e4850>
>>> etree.parse("http://adevp01:8080/validSummary-1.2.xml")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "etree.pyx", line 2065, in etree.parse
  File "parser.pxi", line 1004, in etree._parseDocument
  File "parser.pxi", line 1008, in etree._parseDocumentFromURL
  File "parser.pxi", line 925, in etree._parseDocFromFile
  File "parser.pxi", line 585, in etree._BaseParser._parseDocFromFile
  File "parser.pxi", line 682, in etree._handleParseResult
  File "parser.pxi", line 630, in etree._raiseParseError
etree.XMLSyntaxError: Attempt to load network entity http://adevp01:8080/validSummary-1.2.xml
>>> etree.parse("http://adevp01:8080/validSummary-1.2.xml")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "etree.pyx", line 2065, in etree.parse
  File "parser.pxi", line 1004, in etree._parseDocument
  File "parser.pxi", line 1008, in etree._parseDocumentFromURL
  File "parser.pxi", line 925, in etree._parseDocFromFile
  File "parser.pxi", line 585, in etree._BaseParser._parseDocFromFile
  File "parser.pxi", line 682, in etree._handleParseResult
  File "parser.pxi", line 630, in etree._raiseParseError
etree.XMLSyntaxError: Attempt to load network entity http://adevp01:8080/validSummary-1.2.xml
>>> etree.parse("http://adevp01:8080/validSummary-1.2.xml")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "etree.pyx", line 2065, in etree.parse
  File "parser.pxi", line 1004, in etree._parseDocument
  File "parser.pxi", line 1008, in etree._parseDocumentFromURL
  File "parser.pxi", line 925, in etree._parseDocFromFile
  File "parser.pxi", line 585, in etree._BaseParser._parseDocFromFile
  File "parser.pxi", line 682, in etree._handleParseResult
  File "parser.pxi", line 630, in etree._raiseParseError
etree.XMLSyntaxError: Attempt to load network entity http://adevp01:8080/validSummary-1.2.xml
>>>

Holger

Holger Joukl (jholg) wrote :

I rather often use local files, so I ran into this by accident. 1.3 does not have the same problem (same libxml2 version).

scoder (scoder) wrote :

The behaviour changed in lxml 2.0, we no longer access the network by default (see "no_network" parser arg).

Apart from that, this looks like a problem with libxml2, I'll ask on the libxml2 list.

scoder (scoder) wrote :

I added a work around in trunk revision 45375. We now reset the parser options after parsing, so that the NONET option cannot leak into the next call.

Holger Joukl (jholg) wrote :

Tried current trunk, multiple network resource access now works for me.
I'm wondering if intended behaviour for 2.0 is reached now, though, if you want network
lookup to be not the default but an explicit option, as I did nothing I'm aware of
to enable network access for the parser.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers