From 6d6d6daf7b4928182fc0ea4b03ee00f5a326ed3a Mon Sep 17 00:00:00 2001 From: Michael Behrisch Date: Thu, 12 Sep 2024 07:25:22 +0200 Subject: [PATCH] working around lxml deficiency fix #15422 --- tools/sumolib/net/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/sumolib/net/__init__.py b/tools/sumolib/net/__init__.py index 5f8366a7dfce..9eab6422965d 100644 --- a/tools/sumolib/net/__init__.py +++ b/tools/sumolib/net/__init__.py @@ -40,6 +40,7 @@ try: import lxml.etree + import pathlib HAVE_LXML = True except ImportError: HAVE_LXML = False @@ -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)