Skip to content

Commit

Permalink
working around lxml deficiency fix #15422
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Sep 12, 2024
1 parent e77a195 commit 6d6d6da
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/sumolib/net/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

try:
import lxml.etree
import pathlib
HAVE_LXML = True
except ImportError:
HAVE_LXML = False
Expand Down Expand Up @@ -965,6 +966,8 @@ def readNet(filename, **others):
except IOError:
source = filename
if HAVE_LXML and others.get("lxml", True):
if isinstance(source, pathlib.Path):
source = str(source)
for event, v in lxml.etree.iterparse(source, events=("start", "end")):
if event == "start":
netreader.startElement(v.tag, v.attrib)
Expand Down

0 comments on commit 6d6d6da

Please sign in to comment.