Calling lca method on Activity Object in Brightway giving an Error

46 Views Asked by At

I was trying to run a quick LCA and noticed the LCA method on Activity objects did not work.

I have never used it before, and I don't plan on using it, but it's nice to know if it works for quick LCAs or if it Doesn't work, and if it doesn't, I can open an issue on GitHub.

Here is what I tried to do.

bg = bd.Database('ecoinvent391cutoff')
xx = bg.random()
method = [method for method in bd.methods if method == ('IPCC 2021', 'climate change', 'GWP 100a, incl. H')]
xx.lca(method = method[0])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[9], line 1
----> 1 xx.lca(method = method[0])

File ~/anaconda3/envs/lcdna/lib/python3.11/site-packages/bw2data/proxies.py:110, in ActivityProxyBase.lca(self, method, amount)
    107 """Shortcut to construct an LCA object for this activity."""
    108 from bw2calc import LCA
--> 110 lca = LCA({self: amount}, method=method)
    111 lca.lci()
    112 if method is not None:

File ~/anaconda3/envs/lcdna/lib/python3.11/site-packages/bw2calc/lca.py:97, in LCA.__init__(self, demand, method, weighting, normalization, data_objs, remapping_dicts, log_config, seed_override, use_arrays, use_distributions, selective_use)
     95 if data_objs is None:
     96     self.ensure_bw2data_available()
---> 97     demand, self.packages, remapping_dicts = prepare_lca_inputs(
     98         demand=demand,
     99         method=method,
    100         weighting=weighting,
    101         normalization=normalization,
    102     )
    103     self.method = method
    104     self.weighting = weighting

File ~/anaconda3/envs/lcdna/lib/python3.11/site-packages/bw2data/compat.py:74, in prepare_lca_inputs(demand, method, weighting, normalization, demands, remapping, demand_database_last)
...
---> 46         array[i] = row
     47     if i < bucket_size - 1:
     48         array = array[: i + 1]

TypeError: int() argument must be a string, a bytes-like object or a real number, not 'type'
0

There are 0 best solutions below