NoFoolLikeOne / EDMC-Screenshot

A plugin for EDMC that detects screenshot events are converts them to PNG format
GNU General Public License v3.0
34 stars 4 forks source link

Unable to process screenshots on certain bodies due to invalid temperatures/values in Status.json #45

Closed chennin closed 3 years ago

chennin commented 3 years ago

See https://github.com/EDCD/EDMarketConnector/issues/1194 , but this is for the EDMC-Screenshot specific issue

EDMC-Screenshot is showing "error" and not processing screenshots for me on a body with a temperature of 0K, because Status.json is sometimes (multiple times per second) having a temperature of -nan(ind), and the plugin is failing to parse that, and, I assume, cannot get the location name in order to rename the file.

Suggestion: handle this better by not dumping stack, having some default name, and/or bubble up an error to the UI?

2021-07-12 18:14:40.648 - ERROR - 129116:129196:129196 plug.notify_journal_entry:271: Plugin "Screenshot" failed
Traceback (most recent call last):
  File "plug.pyc", line 268, in notify_journal_entry
  File "C:\Users\Chris\AppData\Local\EDMarketConnector\plugins\EDMC-Screenshot-5.0.0\load.py", line 446, in journal_entry
    focus = getGuiFocus()
  File "C:\Users\Chris\AppData\Local\EDMarketConnector\plugins\EDMC-Screenshot-5.0.0\load.py", line 385, in getGuiFocus
    data = json.load(json_file)
  File "json\__init__.pyc", line 293, in load
  File "json\__init__.pyc", line 346, in loads
  File "json\decoder.pyc", line 337, in decode
  File "json\decoder.pyc", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 142 (char 141)
chennin commented 3 years ago

Suggestion from @Athanasius: use dashboard_entry() in your plugin, which will give you the latest Status.json content as it's detected and loaded, rather than loading it yourself

(although I don't think that will fix the bug here? It is ultimately a Frontier problem that EDMC isn't going to work around)