summaryrefslogtreecommitdiff
path: root/psutil/_pslinux.py
diff options
context:
space:
mode:
Diffstat (limited to 'psutil/_pslinux.py')
-rw-r--r--psutil/_pslinux.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py
index 02784602..33bafd28 100644
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py
@@ -708,17 +708,11 @@ elif os.path.exists("/proc/cpuinfo"):
min and max frequencies are not available and are set to None.
"""
ret = []
- path = '%s/cpuinfo' % get_procfs_path()
- if os.path.exists(path):
- try:
- with open_binary(path) as f:
- for line in f:
- if line.lower().startswith(b'cpu mhz'):
- key, value = line.split(b'\t:', 1)
- ret.append(_common.scpufreq(float(value), 0., 0.))
- except IOError as err:
- raise NotImplementedError(
- "%r for file %r" % (err, path))
+ with open_binary('%s/cpuinfo' % get_procfs_path()) as f:
+ for line in f:
+ if line.lower().startswith(b'cpu mhz'):
+ key, value = line.split(b'\t:', 1)
+ ret.append(_common.scpufreq(float(value), 0., 0.))
return ret
else: