BGS-Tally icon indicating copy to clipboard operation
BGS-Tally copied to clipboard

Exception in API Sending

Open aussig opened this issue 1 month ago • 0 comments

2025-11-10 23:06:04.005 UTC - ERROR - 4240:2852:2852 plug.notify_journal_entry:348: Plugin "BGS-Tally" failed
Traceback (most recent call last):
  File "plug.pyc", line 345, in notify_journal_entry
  File "C:\Users\owner\AppData\Local\EDMarketConnector\plugins\BGS-Tally\load.py", line 62, in journal_entry
    this.journal_entry(cmdr, is_beta, system, station, entry, state)
  File "C:\Users\owner\AppData\Local\EDMarketConnector\plugins\BGS-Tally\bgstally\bgstally.py", line 336, in journal_entry
    self.api_manager.send_event(entry, activity, cmdr, mission)
  File "C:\Users\owner\AppData\Local\EDMarketConnector\plugins\BGS-Tally\bgstally\apimanager.py", line 81, in send_event
    api_event: dict = self._build_api_event(event, activity, cmdr, mission)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\owner\AppData\Local\EDMarketConnector\plugins\BGS-Tally\bgstally\apimanager.py", line 293, in _build_api_event
    market_data:dict = self.bgstally.market.get_commodity(event['Type'])
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\owner\AppData\Local\EDMarketConnector\plugins\BGS-Tally\bgstally\market.py", line 67, in get_commodity
    return self.commodities[name] | {}
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'imperialslaves'

This is because the code is assuming that Market.json contains a list of all commodities. That's not the case, so we need to handle the situation where a commodity is not in the file.

aussig avatar Nov 12 '25 16:11 aussig