Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excel database exporter broken #1202

Open
1 task done
marc-vdm opened this issue Jan 12, 2024 · 1 comment
Open
1 task done

Excel database exporter broken #1202

marc-vdm opened this issue Jan 12, 2024 · 1 comment
Labels
bug Issues/PRs related to bugs

Comments

@marc-vdm
Copy link
Member

marc-vdm commented Jan 12, 2024

Updating AB

  • Yes, I have updated AB and still experience this issue

What happened?

To reproduce: File > Export database > Choose database & excel > Finish

Same database bw2package works without issue

Potentially related:

Relevant errors

Traceback (most recent call last):
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\activity_browser\ui\wizards\db_export_wizard.py", line 38, in accept
    self.perform_export()
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\activity_browser\ui\wizards\db_export_wizard.py", line 52, in perform_export
    EXPORTERS[export_as](db_name, out_path)
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\activity_browser\bwutils\exporters.py", line 96, in write_lci_excel
    data = ABCSVFormatter(db_name, objs).get_formatted_data(sections)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\bw2io\export\csv.py", line 202, in get_formatted_data
    data = self.get_unformatted_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\bw2io\export\csv.py", line 187, in get_unformatted_data
    "activities": [self.get_activity(obj) for obj in self.objs],
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\bw2io\export\csv.py", line 187, in <listcomp>
    "activities": [self.get_activity(obj) for obj in self.objs],
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\bw2io\export\csv.py", line 148, in get_activity
    data["exchanges"] = self.get_exchanges(act)
                        ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\bw2io\export\csv.py", line 142, in get_exchanges
    exchanges = [self.exchange_as_dict(exc) for exc in act.exchanges()]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\bw2io\export\csv.py", line 142, in <listcomp>
    exchanges = [self.exchange_as_dict(exc) for exc in act.exchanges()]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\activity_browser\bwutils\exporters.py", line 52, in exchange_as_dict
    data.update(**{k: inp[k] for k in inp_fields if inp.get(k)})
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\activity_browser\bwutils\exporters.py", line 52, in <dictcomp>
    data.update(**{k: inp[k] for k in inp_fields if inp.get(k)})
                                                    ^^^^^^^^^^
  File "<frozen _collections_abc>", line 774, in get
  File "C:\Users\meidemtvander\.conda\envs\abd\Lib\site-packages\bw2data\backends\peewee\proxies.py", line 125, in __getitem__
    if key in rp.get('classifications', []):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'float' is not iterable

Operating system

Windows 10

Conda environment

No response

@marc-vdm marc-vdm added the bug Issues/PRs related to bugs label Jan 12, 2024
@mrvisscher
Copy link
Collaborator

Just to add that bw2package export works in this case, but import on another machine fails using said package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues/PRs related to bugs
Projects
None yet
Development

No branches or pull requests

2 participants