How do I retrieve the temperature of my CPU using Python? (Assuming I'm on Linux)
+1
A:
Py-cputemp at http://sourceforge.net/projects/py-cputemp/ seems to do the job.
DrDee
2010-03-13 23:40:49
py-cputemp is basically a thin veneer over /proc/acpi/thermal_zone. This originally didn't work for me until I realized that I needed to enable ACPI in my BIOS. I had disabled it because I figured I didn't want power management on a server. Thanks for the answer; I'm accepting this one because it was posted first and lead me to think about the source of my problem.
jamieb
2010-03-14 04:06:58
+1
A:
Depending on your Linux distro, you may find a file under /proc
that contains this information. For example, this page suggests /proc/acpi/thermal_zone/THM/temperature
.
Greg Hewgill
2010-03-13 23:41:20
+2
A:
If your Linux supports ACPI, reading pseudo-file /proc/acpi/thermal_zone/THM0/temperature
(the path may differ, I know it's /proc/acpi/thermal_zone/THRM/temperature
in some systems) should do it. But I don't think there's a way that works in every Linux system in the world, so you'll have to be more specific about exactly what Linux you have!-)
Alex Martelli
2010-03-13 23:42:04