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)
1.4m articles
1.4m replys
5 comments
57.0k users