You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

导入ecoinvent 3.6 conseq到Brightway时目标函数报错求助

导入ecoinvent到Brightway时出现KeyError问题

尝试将ecoinvent导入Brightway时,执行以下代码:

ei36 = bw2.SingleOutputEcospold2Importer(ei36dir, "ecoinvent 3.6 conseq")
ei36.apply_strategies()
ei36.statistics()
ei36.write_database()

出现如下错误:

Applying strategy: update_social_flows_in_older_consequential

Traceback (most recent call last):

File "C:\Users\...\test.py", line 24, in <module>
ei36.apply_strategies()

File "C:\Users\...\Lib\site-packages\bw2io\importers\base.py", line 69, in apply_strategies
self.apply_strategy(func, verbose)

File "C:\Users\...\Lib\site-packages\bw2io\importers\base.py", line 48, in apply_strategy
self.data = strategy(self.data)

File "C:\Users\...\Lib\site-packages\bw2io\strategies\ecospold2.py", line 1350, in update_social_flows_in_older_consequential

exc['input'] = cache[exc['name']]

KeyError: 'venting of argon, crude, liquid'

我查看了update_social_flows_in_older_consequential函数的代码,但找不到问题所在:

def update_social_flows_in_older_consequential(db, biosphere_db):

    FLOWS = {
        'residual wood, dry',
        'venting of argon, crude, liquid',
        'venting of nitrogen, liquid',
    }

    cache = {}

    def get_cache(cache, biosphere_db):
        for flow in biosphere_db:
            if flow['name'] in FLOWS:
                cache[flow['name']] = flow.key

    for ds in db:
        for exc in ds['exchanges']:
            if not exc.get('input') and exc['name'] in FLOWS:
                if not cache:
                    get_cache(cache, biosphere_db)
                exc['input'] = cache[exc['name']]
    return db

请问有没有人遇到过类似问题?

内容的提问来源于stack exchange,提问作者lc1234

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 23:08:28