提交 7e8243ba 编写于 作者: N Nicolas Hennion

AttributeError: 'NoneType' object has no attribute 'current' #1875

上级 054597be
......@@ -29,7 +29,7 @@ import sys
# Global name
# Version should start and end with a numerical char
# See https://packaging.python.org/specifications/core-metadata/#version
__version__ = '3.2.0b0'
__version__ = '3.2.0b1'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPLv3'
......
......@@ -66,8 +66,10 @@ class CpuPercent(object):
if self.timer_cpu_info.finished() and hasattr(psutil, 'cpu_freq'):
# Get the CPU freq current/max
cpu_freq = psutil.cpu_freq()
self.cpu_info['cpu_hz_current'] = cpu_freq.current
self.cpu_info['cpu_hz'] = cpu_freq.max
if hasattr(cpu_freq, 'current'):
self.cpu_info['cpu_hz_current'] = cpu_freq.current
if hasattr(cpu_freq, 'cpu_hz'):
self.cpu_info['cpu_hz'] = cpu_freq.max
# Reset timer for cache
self.timer_cpu_info.reset(duration=self.cached_timer_cpu_info)
return self.cpu_info
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册