oie-mines-paristech / lca_algebraic

Layer over brightway2 for algebraic definition of parametric models and super fast computation of LCA
BSD 2-Clause "Simplified" License
40 stars 18 forks source link

listExchanges() keyerror 'name' #20

Closed simb-sdu closed 2 years ago

simb-sdu commented 2 years ago

Error only occurs on my foreground database (which only contain the foreground process test_model. Test_model references twoprocesses from my ecoinvent 3.8 background database. listExchanges() does not trigger the keyerror if i run it on a proces from the background database

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Input In [10], in <cell line: 1>()
----> 1 test_model.listExchanges()

File ~\Anaconda3\envs\ab\lib\site-packages\lca_algebraic\helpers.py:88, in with_db_context.<locals>.wrapper(*args, **kwargs)
     86 dbname = act.key[0]
     87 with DbContext(dbname) :
---> 88     return func(*args, **kwargs)

File ~\Anaconda3\envs\ab\lib\site-packages\lca_algebraic\helpers.py:109, in ActivityExtended.listExchanges(self)
    107     input = bw.get_activity(exc.input.key)
    108     amount = _getAmountOrFormula(exc)
--> 109     res.append((exc["name"], input, amount))
    110 return res

File ~\Anaconda3\envs\ab\lib\site-packages\bw2data\proxies.py:40, in ProxyBase.__getitem__(self, key)
     39 def __getitem__(self, key):
---> 40     return self._data[key]

KeyError: 'name'
simb-sdu commented 2 years ago

note that all processes are made in Activity Browser, and loaded by test_model = findActivity("test_model", db_name=USER_DB)

simb-sdu commented 2 years ago

seems like thi was fixed in #14

However seems like this has is not included in the version installed via conda install -c oie-minesparistech lca_algebraic. But installing via pip install lca_algebraic does get version 1.03 which fixed the error

It seems like the development of the master branch has stalled? I think this is a shame as lca_algebraic is very useful, but unfortunately it does not work at the moment

raphaeljolivet commented 2 years ago

I have just released 1.0.3 as a Conda package as well.