0

这里有一个以前的问题,但它没有帮助我解决我的问题:

当我尝试使用 .amount = myamount 更改交换金额时,我总是收到“无法设置属性错误”。

这是我所做的:

## search for activity
msw = [get_activity(key) for key, ds in eco.items() if 
           'treatment of municipal solid waste, incineration' in ds['name'] and 
           ds['location'] == ('BE') and ds['unit'] == 'kilogram']

##make a copy
msw_be = msw.copy()

##get exchange
Carbon_dioxide_non_fossil = [exc for exc in mswi_be.biosphere() if 'Carbon dioxide, non-fossil' in exc['name']][0]

接着

##change amount
Carbon_dioxide_non_fossil.amount = 0.75152

这是我得到错误的地方。感谢你们对我的帮助。

4

1 回答 1

0

您的活动就像字典一样,不支持属性访问。试试这个:

Carbon_dioxide_non_fossil['amount'] = 0.75152
Carbon_dioxide_non_fossil.save()
于 2018-01-23T12:15:40.060 回答