diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index 4c973c2d3..ac45b54b3 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -668,7 +668,7 @@ def cpu_stats(): ctx_switches, interrupts, soft_interrupts, syscalls) -if os.path.exists("/sys/devices/system/cpu/cpufreq") or \ +if os.path.exists("/sys/devices/system/cpu/cpufreq/policy0") or \ os.path.exists("/sys/devices/system/cpu/cpu0/cpufreq"): def cpu_freq(): """Return frequency metrics for all CPUs. @@ -715,6 +715,12 @@ def cpu_freq(): ret.append(_common.scpufreq(float(value), 0.0, 0.0)) return ret +else: + def cpu_freq(): + """Dummy implementation when none of the above files are present. + """ + return [] + # ===================================================================== # --- network