-
Notifications
You must be signed in to change notification settings - Fork 0
Description
What happened?
I’ve been experimenting with the pyESDL library in QGIS 3.40.8 LTR (Python 3.12).
Initially everything worked fine, but after a while calling esh.save() started crashing QGIS with a Windows fatal access violation.
Example script
New ESDL-object
es = EnergySystem(id=generate_uuid(), name="QGIS export")
esi = esdl.EnergySystemInformation(id=generate_uuid())
carriers = esdl.Carriers(id=generate_uuid())
HeatCommodity_supply_id = generate_uuid()
supply = esdl.HeatCommodity(id=HeatCommodity_supply_id,name="Supply",supplyTemperature=110.0)
carriers.carrier.extend([supply])
esi.carriers = carriers
es.energySystemInformation = esi
inst = Instance(id=generate_uuid(), name="Generated instance")
area = Area(id=generate_uuid(), name="Generated area")
inst.area = area
es.instance.append(inst)
esh = EnergySystemHandler()
esh.energy_system = es
esh.save(params.export_path)
QGIS error:
Windows fatal exception: access violation
Current thread 0x0000531c (most recent call first):
File ".../esdl/resources/xmi.py", line 416 in _go_across
node = Element(tag)
Steps to reproduce
Install pyESDL and lxml in QGIS (Python 3.12).
Run the example script above.
Call esh.save() → crash occurs.
After testing, I found the issue is related to lxml.
System details
QGIS: 3.40.8 LTR (OSGeo4W)
Python: 3.12
lxml: 5.3.0 (default from pip)
pyESDL: unknown version (no version available, likely recent)
Diagnosis
Downgrading lxml fixes the problem:
pip uninstall lxml
pip install lxml==4.9.3
This strongly suggests that pyESDL is incompatible with lxml >= 5.0, possibly due to stricter tag handling or internal API changes.