Closed michaelweinold closed 2 years ago
Attempting to debug the cell additionally lead to a loop of error messages in VS Code:
Compare also https://github.com/microsoft/vscode/issues/164676
Compare the notebook by Agez et al.: https://github.com/OASES-project/pylcaio/blob/master/doc/export%20to%20brightway2.ipynb
Not sure how this interfaces with VSCode, but I would run this in ipython and then use %debug
to figure out what is missing. But I guess that this is the input
attribute, meaning that you tried to consume something, but couldn't find the exact match for the name
or reference product
or similar. Some names changed in ecoinvent 3.9, but maybe also against earlier versions as well.
You could also hotpatch the breaking code to log the attributes of the exchange causing the problem.
before "ecoi_importer.write_database" it would be safer to make sure there aren't any unlinked exchanges, and for "debug" purposes print the unlinked ones.
File ~/pylcaio/src/pylcaio.py:2174, in Analysis.export_to_brightway2(self, bw2_project_name, created_database_name, path_to_ecoinvent_ecospold_datasets, aggregated)
2172 eco_importer = SingleOutputEcospold2Importer(path_to_ecoinvent_ecospold_datasets, 'hybrid-ecoinvent')
2173 eco_importer.apply_strategies()
-> 2174 eco_importer.write_database()
2176 if not aggregated:
2177 # importing exiobase into the project
2178 self.import_exiobase_into_brightway2()
The error message is caused by unmatched exchanges. Compare also the brightway
documentation.
Attempting to export the hybridized database to a Brightway project using the a method from the
pylcaio.Analysis
class:throws the following error: