When trying to import the following file AB_LCI_HPO.xlsx which has been exported from Activity Browser, I get an error. This error happens with various files but not with all my files; while they all have been exported the same way, on the same computer, and on the same version of AB and ecoinvent.
When trying to import the following file AB_LCI_HPO.xlsx which has been exported from Activity Browser, I get an error. This error happens with various files but not with all my files; while they all have been exported the same way, on the same computer, and on the same version of AB and ecoinvent.
Versions:
Application version: 2.10.3 bw2data version: 3.6.6 bw2io version: 1.8.2 bw2calc version: 0.8.12
Python code
I run the code using ExcelImporter
ERROR in the console:
Error logs
``` --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[7], line 10 7 imp.write_excel() 8 list(imp.unlinked) ---> 10 imp.write_database() File [~\AppData\Local\anaconda3\envs\premise\Lib\site-packages\bw2io\importers\excel.py:284](http://localhost:8888/lab/tree/Users/andraded/Documents/autumn-school-2024/autumn-school-dds-psi-2024/tutorials/activity_browser/~/AppData/Local/anaconda3/envs/premise/Lib/site-packages/bw2io/importers/excel.py#line=283), in ExcelImporter.write_database(self, **kwargs) 282 """Same as base ``write_database`` method, but ``activate_parameters`` is True by default.""" 283 kwargs["activate_parameters"] = kwargs.get("activate_parameters", True) --> 284 super(ExcelImporter, self).write_database(**kwargs) File [~\AppData\Local\anaconda3\envs\premise\Lib\site-packages\bw2io\importers\base_lci.py:273](http://localhost:8888/lab/tree/Users/andraded/Documents/autumn-school-2024/autumn-school-dds-psi-2024/tutorials/activity_browser/~/AppData/Local/anaconda3/envs/premise/Lib/site-packages/bw2io/importers/base_lci.py#line=272), in LCIImporter.write_database(self, data, delete_existing, backend, activate_parameters, **kwargs) 270 self.write_database_parameters(activate_parameters, delete_existing) 272 existing.update(data) --> 273 db.write(existing) 275 if activate_parameters: 276 self._write_activity_parameters(activity_parameters) File [~\AppData\Local\anaconda3\envs\premise\Lib\site-packages\bw2data\project.py:358](http://localhost:8888/lab/tree/Users/andraded/Documents/autumn-school-2024/autumn-school-dds-psi-2024/tutorials/activity_browser/~/AppData/Local/anaconda3/envs/premise/Lib/site-packages/bw2data/project.py#line=357), in writable_project(wrapped, instance, args, kwargs) 356 if projects.read_only: 357 raise ReadOnlyProject(READ_ONLY_PROJECT) --> 358 return wrapped(*args, **kwargs) File [~\AppData\Local\anaconda3\envs\premise\Lib\site-packages\bw2data\backends\peewee\database.py:266](http://localhost:8888/lab/tree/Users/andraded/Documents/autumn-school-2024/autumn-school-dds-psi-2024/tutorials/activity_browser/~/AppData/Local/anaconda3/envs/premise/Lib/site-packages/bw2data/backends/peewee/database.py#line=265), in SQLiteBackend.write(self, data, process) 263 self.delete(warn=False) 264 raise --> 266 self.make_searchable(reset=True) 268 if process: 269 self.process() File [~\AppData\Local\anaconda3\envs\premise\Lib\site-packages\bw2data\project.py:358](http://localhost:8888/lab/tree/Users/andraded/Documents/autumn-school-2024/autumn-school-dds-psi-2024/tutorials/activity_browser/~/AppData/Local/anaconda3/envs/premise/Lib/site-packages/bw2data/project.py#line=357), in writable_project(wrapped, instance, args, kwargs) 356 if projects.read_only: 357 raise ReadOnlyProject(READ_ONLY_PROJECT) --> 358 return wrapped(*args, **kwargs) File [~\AppData\Local\anaconda3\envs\premise\Lib\site-packages\bw2data\backends\peewee\database.py:311](http://localhost:8888/lab/tree/Users/andraded/Documents/autumn-school-2024/autumn-school-dds-psi-2024/tutorials/activity_browser/~/AppData/Local/anaconda3/envs/premise/Lib/site-packages/bw2data/backends/peewee/database.py#line=310), in SQLiteBackend.make_searchable(self, reset) 309 databases.flush() 310 IndexManager(self.filename).delete_database() --> 311 IndexManager(self.filename).add_datasets(self) File [~\AppData\Local\anaconda3\envs\premise\Lib\site-packages\bw2data\search\indices.py:47](http://localhost:8888/lab/tree/Users/andraded/Documents/autumn-school-2024/autumn-school-dds-psi-2024/tutorials/activity_browser/~/AppData/Local/anaconda3/envs/premise/Lib/site-packages/bw2data/search/indices.py#line=46), in IndexManager.add_datasets(self, datasets) 45 writer = self.get().writer() 46 for ds in datasets: ---> 47 writer.add_document(**self._format_dataset(ds)) 48 writer.commit() File [~\AppData\Local\anaconda3\envs\premise\Lib\site-packages\bw2data\search\indices.py:35](http://localhost:8888/lab/tree/Users/andraded/Documents/autumn-school-2024/autumn-school-dds-psi-2024/tutorials/activity_browser/~/AppData/Local/anaconda3/envs/premise/Lib/site-packages/bw2data/search/indices.py#line=34), in IndexManager._format_dataset(self, ds) 29 def _format_dataset(self, ds): 30 fl = lambda o: o[1].lower() if isinstance(o, tuple) else o.lower() 31 return dict( 32 name=ds.get(u"name", u"").lower(), 33 comment=ds.get(u"comment", u"").lower(), 34 product=ds.get(u"reference product", u"").lower(), ---> 35 categories=u", ".join(ds.get(u"categories", [])).lower(), 36 location=fl(ds.get(u"location", u"")), 37 database=ds[u"database"], 38 code=ds['code'] 39 ) File [~\AppData\Local\anaconda3\envs\premise\Lib\_collections_abc.py:774](http://localhost:8888/lab/tree/Users/andraded/Documents/autumn-school-2024/autumn-school-dds-psi-2024/tutorials/activity_browser/~/AppData/Local/anaconda3/envs/premise/Lib/_collections_abc.py#line=773), in Mapping.get(self, key, default) 772 'D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.' 773 try: --> 774 return self[key] 775 except KeyError: 776 return default File [~\AppData\Local\anaconda3\envs\premise\Lib\site-packages\bw2data\backends\peewee\proxies.py:125](http://localhost:8888/lab/tree/Users/andraded/Documents/autumn-school-2024/autumn-school-dds-psi-2024/tutorials/activity_browser/~/AppData/Local/anaconda3/envs/premise/Lib/site-packages/bw2data/backends/peewee/proxies.py#line=124), in Activity.__getitem__(self, key) 122 except ValueError: 123 raise KeyError --> 125 if key in rp.get('classifications', []): 126 return rp['classifications'][key] 127 if key in rp.get('properties', []): TypeError: argument of type 'float' is not iterable ```