提交 9d16fbb7 编写于 作者: N nicolargo

Crash on startup: KeyError: 'hz_actual_raw' on Raspbian 9.1 #1170

上级 55682787
......@@ -19,6 +19,7 @@ Bugs corrected:
* glances_plugin.py has a problem with specific docker output #1160
* Key error 'address' in the IP plugin #1176
* NameError: name 'mode' is not defined in case of interrupt shortly after starting the server mode #1175
* Crash on startup: KeyError: 'hz_actual_raw' on Raspbian 9.1 #1170
Backward-incompatible changes:
......
......@@ -81,9 +81,11 @@ class Plugin(GlancesPlugin):
cpu_info = cpuinfo.get_cpu_info()
# Check cpu_info (issue #881)
if cpu_info is not None:
self.stats['cpu_name'] = cpu_info['brand']
self.stats['cpu_hz_current'] = cpu_info['hz_actual_raw'][0]
self.stats['cpu_hz'] = cpu_info['hz_advertised_raw'][0]
self.stats['cpu_name'] = cpu_info.get('brand', 'CPU')
if 'hz_actual_raw' in cpu_info:
self.stats['cpu_hz_current'] = cpu_info['hz_actual_raw'][0]
if 'hz_advertised_raw' in cpu_info:
self.stats['cpu_hz'] = cpu_info['hz_advertised_raw'][0]
return self.stats
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册