amsbr / OctoPrint-Stats

24 stars 15 forks source link

Stats don't load after fresh 2.0.2 installation #30

Closed joachimklug closed 4 years ago

joachimklug commented 4 years ago

Hi, I discovered this plugin and installed version 2.0.2. After doing a test print there is only a spinning wheel on the stats page without anything else showing.

image

octoprint.log is showing following error: 2019-11-13 00:44:39,496 - octoprint.server.api - ERROR - Error calling SimpleApiPlugin stats Traceback (most recent call last): File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/api/__init__.py", line 68, in pluginData response = api_plugin.on_api_get(request) File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_stats/__init__.py", line 293, in on_api_get self.refreshFull(filter_param=self.current_filter) File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_stats/__init__.py", line 469, in refreshFull print_failed_count = self.filterEvent("PRINT_FAILED", group = "ym", filterp=filter_param) File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_stats/__init__.py", line 395, in filterEvent event_df['ptime'] = event_df['ptime'].apply(self.formatNum) File "/home/pi/oprint/local/lib/python2.7/site-packages/pandas/core/frame.py", line 2927, in __getitem__ indexer = self.columns.get_loc(key) File "/home/pi/oprint/local/lib/python2.7/site-packages/pandas/core/indexes/base.py", line 2659, in get_loc return self._engine.get_loc(self._maybe_cast_indexer(key)) File "pandas/_libs/index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'ptime' 2019-11-13 00:44:39,504 - tornado.access - ERROR - 500 GET /api/plugin/stats?filter=current_month (2a02:8070:d187:aa00:8d2:b853:d81f:82e3) 263.09ms

Further my octoprint_stats.json looks like this: {"_default": {}, "events": {"1": {"data": {"baudrate": 0, "port": "AUTO", "event_time": "2019-11-13 00:23:31.016106"}, "event_type": "CONNECTED"}, "2": {"data": {"origin": "local", "tool1_target": 0, "name": "bicycle_key_0.2mm_PETG_MK3S_9m.gcode", "event_time": "2019-11-13 00:24:17.863492", "bed_target": 0.0, "tool2_target": 0, "user": "klu", "file": "done_2018/bicycle_key_0.2mm_PETG_MK3S_9m.gcode", "owner": "klu", "tool0_target": 0.0, "size": 498832}, "event_type": "PRINT_STARTED"}, "3": {"data": {"origin": "local", "bed_actual": 90.0, "ptime": 796.3589505130003, "event_time": "2019-11-13 00:37:34.915086", "tool1_volume": 0, "tool2_length": 0, "owner": "klu", "name": "bicycle_key_0.2mm_PETG_MK3S_9m.gcode", "tool2_actual": 0, "tool0_volume": 0.9077930909815062, "size": 498832, "file": "done_2018/bicycle_key_0.2mm_PETG_MK3S_9m.gcode", "tool0_actual": 239.5, "tool1_actual": 0, "tool2_volume": 0, "tool1_length": 0, "tool0_length": 377.41651000000627}, "event_type": "PRINT_DONE"}}}

Anything I can do?

joachimklug commented 4 years ago

Issue solved by PR