Skip to content

Commit

Permalink
Fix product information ecospold2 extraction with invalid inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Nov 27, 2024
1 parent 32b0253 commit 7346925
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bw2io/extractors/ecospold2.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ def extract_metadata(o):
dct = {"name": o.name.text, "unit": o.unitName.text, "id": o.get("id")}
if hasattr(o, "productInformation"):
dct["product_information"] = " ".join(
[child.text for child in o.productInformation.iterchildren()]
[
child.text.strip()
for child in o.productInformation.iterchildren()
if child
and hasattr(child, "text")
and isinstance(child.text, str)
]
)
else:
dct["product_information"] = ""
Expand Down

0 comments on commit 7346925

Please sign in to comment.