brightway-lca / brightway2-io

Importing and exporting for the Brightway LCA framework
BSD 3-Clause "New" or "Revised" License
26 stars 40 forks source link

KeyError in IOTable backend #255

Open mfastudillo opened 4 months ago

mfastudillo commented 4 months ago

I've been using the IOTable backend and the calculations work fine, but there seems to be a problem when trying to iterate over the exchanges. I am not sure of what the cause of the problem is. @michaelweinold or perhaps @BenPortner know ?

imagen

BenPortner commented 4 months ago

This code is part of a re-write that @cmutel did so I'm not 100% sure. It seems to me that https://github.com/brightway-lca/brightway2-data/commit/f3a3db2534f8ce73552bc75eb5be094afa8e56b7 fixed a similar error for the technosphere flows. @mfastudillo since you already have it all set up: Could you check if changing line 231 to

bm = lambda x: any(obj.get("matrix") == "biosphere_matrix" for obj in x.values())

Solves the problem?

mfastudillo commented 4 months ago

it seems to be as easy as that @BenPortner :)