I need an example code for accessing CPU temperature in python.
I'm running windows 7, BTW.
Use the WMI module + Open Hardware Monitor + its WMI interface described here.
Sample code:
import wmi w = wmi.WMI(namespace="rootOpenHardwareMonitor") temperature_infos = w.Sensor() for sensor in temperature_infos: if sensor.SensorType==u'Temperature': print(sensor.Name) print(sensor.Value)
2.1m questions
2.1m answers
60 comments
57.0k users