brightway-lca / brightway2-ui

a command line tool for brightway
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

top processes & emissions commands are broken #26

Closed tngTUDOR closed 8 months ago

tngTUDOR commented 8 months ago

Current

when invoking ta command after doing an lcia (with G command) we get:

  File "/home/duende/miniforge3/envs/bw2ui-dev/bin/bw2-browser", line 33, in <module>
    sys.exit(load_entry_point('bw2ui', 'console_scripts', 'bw2-browser')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/duende/workspaces/brightway2-ui/bw2ui/bin/bw2_browser.py", line 1471, in main
    activitybrowser.cmdloop()
  File "/home/duende/miniforge3/envs/bw2ui-dev/lib/python3.11/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
           ^^^^^^^^^^^^^^^^^
  File "/home/duende/miniforge3/envs/bw2ui-dev/lib/python3.11/cmd.py", line 217, in onecmd
    return func(arg)
           ^^^^^^^^^
  File "/home/duende/workspaces/brightway2-ui/bw2ui/bin/bw2_browser.py", line 1222, in do_ta
    top_a = lca.top_activities()
            ^^^^^^^^^^^^^^^^^^
AttributeError: 'LCA' object has no attribute 'top_activities'

Expected

The command works providing the list of top activities and top emissions

tngTUDOR commented 8 months ago

The solution is to use the brrightway2analyzer methods instead of the deprecated LCA ones (that were already calling bw2analyzer anyway).

tngTUDOR commented 8 months ago

v 0.31.0 has a fix for this.