Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psutil.cpu_freq() fails with FileNotFoundError on CentOS 7.3 #1114

Closed
sethmlarson opened this issue Jul 31, 2017 · 2 comments
Closed

psutil.cpu_freq() fails with FileNotFoundError on CentOS 7.3 #1114

sethmlarson opened this issue Jul 31, 2017 · 2 comments

Comments

@sethmlarson
Copy link

import psutil
psutil.cpu_freq()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/slarson/.python3/bin/lib/python3.5/site-packages/psutil/__init__.py", line 1895, in cpu_freq
    ret = _psplatform.cpu_freq()
  File "/home/slarson/.python3/bin/lib/python3.5/site-packages/psutil/_pslinux.py", line 666, in cpu_freq
    curr = int(cat(os.path.join(path, "scaling_cur_freq"))) / 1000
  File "/home/slarson/.python3/bin/lib/python3.5/site-packages/psutil/_pslinux.py", line 298, in cat
    with open_binary(fname) if binary else open_text(fname) as f:
  File "/home/slarson/.python3/bin/lib/python3.5/site-packages/psutil/_pslinux.py", line 190, in open_binary
    return open(fname, "rb", **kwargs)
FileNotFoundError: [Errno 2] No such file or directory: '/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq'

Here is the output of ls -Al /sys/devices/system/cpu/cpu0/cpufreq:

$ ls -Al /sys/devices/system/cpu/cpu0/cpufreq
total 0
-r--r--r--. 1 root root 4096 Jul 31 15:32 affected_cpus
-r--------. 1 root root 4096 Jul 31 15:32 cpuinfo_cur_freq
-r--r--r--. 1 root root 4096 Jul 31 15:32 cpuinfo_max_freq
-r--r--r--. 1 root root 4096 Jul 31 15:32 cpuinfo_min_freq
-r--r--r--. 1 root root 4096 Jul 31 15:32 cpuinfo_transition_latency
-r--r--r--. 1 root root 4096 Jul 31 15:32 related_cpus
-r--r--r--. 1 root root 4096 Jul 31 15:32 scaling_available_governors
-r--r--r--. 1 root root 4096 Jul 31 15:32 scaling_driver
-rw-r--r--. 1 root root 4096 Jul 31 15:32 scaling_governor
-rw-r--r--. 1 root root 4096 Jul 31 15:32 scaling_max_freq
-rw-r--r--. 1 root root 4096 Jul 31 15:32 scaling_min_freq
-rw-r--r--. 1 root root 4096 Jul 31 15:32 scaling_setspeed

Was wondering if this issue could be fixed somehow? I can give the contents of these files if needed.

@wiggin15
Copy link
Collaborator

I believe this is a duplicate of #1071 which is fixed in master branch but not yet released.

For further reference, this is documented in a RHEL KB article: https://access.redhat.com/solutions/3116471 (may require RedHat login). Their resolution states: This fix will be included in Red Hat Enterprise Linux 7.4.

@giampaolo
Copy link
Owner

Right, this is a duplicate of #1071.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants