Skip to content

Importation of db in Excel format failing #1611

@Paul-Robineau

Description

@Paul-Robineau

What do you want to report?

Hi everyone!

What happened

When a database is exported as an Excel file from AB, it is not possible to import it back.
On the other end, Export/Import with brightway2package format works fine.
I provide a minimal working example database linked here in the 2 formats, but I guess it can be tested with any custom test_db. Mine contains a minimal amount of inputs and outputs, randomly selected.

It does not seem to depend on:

  • changing or not changing the name of the files at any point of the export/import sequence
  • keeping or deleting the test_db in AB

How to reproduce

Download the zip containing the 2 files OR create a minimal working example test_db in AB, then export it as bw2package and xlsx files.

  1. Import the test_db bw2package -> it will succeed
    Export it as test_db2 xlsx -> it will succeed
    Try to import the test_db2 xlsx -> it will fail

  2. Import the original test_db xlsx -> it will fail

  3. Import the test_db bw2package -> it will succeed
    Export it as test_db2 bw2package -> it will succeed
    Try to import the test_db2 bw2package -> it will succeed

Software

Ubuntu 24.04.3 LTS

Material

test_db.zip

Relevant errors

Extracted 1 worksheets in 0.00 seconds
Applying strategies: 100%|████████████████████| 19/19 [00:00<00:00, 3989.58it/s]
Applying strategy: relink_exchanges_with_db
Applying strategy: relink_exchanges_with_db
Error calling Python override of QThread::run(): 17:30:06 | ERROR | LinkingFailed: ([{'name': '1,2-Dibromoethane', 'amount': 1, 'database': 'biosphere-3.11', 'unit': 'kilogram', 'categories': ('water',), 'type': 'biosphere'}, {'name': 'Merphos', 'amount': 1, 'database': 'biosphere-3.11', 'unit': 'kilogram', 'categories': ('water',), 'type': 'biosphere'}, {'name': 'Sedaxane', 'amount': 1, 'database': 'biosphere-3.11', 'unit': 'kilogram', 'categories': ('water', 'surface water'), 'type': 'biosphere'}], {'biosphere-3.11'})
Traceback (most recent call last):
  File "/home/paul-robineau/anaconda3/envs/ab_beta/lib/python3.11/site-packages/activity_browser/ui/core/threading.py", line 42, in run
    raise e
  File "/home/paul-robineau/anaconda3/envs/ab_beta/lib/python3.11/site-packages/activity_browser/ui/core/threading.py", line 38, in run
    self.run_safely(*self._args, **self._kwargs)
  File "/home/paul-robineau/anaconda3/envs/ab_beta/lib/python3.11/site-packages/activity_browser/actions/database/database_importer_excel.py", line 139, in run_safely
    importer.automated_import(database_name, linking_dict)
  File "/home/paul-robineau/anaconda3/envs/ab_beta/lib/python3.11/site-packages/activity_browser/bwutils/importers.py", line 124, in automated_import
    raise LinkingFailed(excs, databases)
activity_browser.bwutils.errors.LinkingFailed: ([{'name': '1,2-Dibromoethane', 'amount': 1, 'database': 'biosphere-3.11', 'unit': 'kilogram', 'categories': ('water',), 'type': 'biosphere'}, {'name': 'Merphos', 'amount': 1, 'database': 'biosphere-3.11', 'unit': 'kilogram', 'categories': ('water',), 'type': 'biosphere'}, {'name': 'Sedaxane', 'amount': 1, 'database': 'biosphere-3.11', 'unit': 'kilogram', 'categories': ('water', 'surface water'), 'type': 'biosphere'}], {'biosphere-3.11'})

Version

3.0.0b1163

Installation method

Anaconda (conda)

Operating system

Linux/Other (please specify above)

Metadata

Metadata

Assignees

No one assigned

    Labels

    betaIssues related to the Activity Browser 3 Beta

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions