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="root\OpenHardwareMonitor")
temperature_infos = w.Sensor()
for sensor in temperature_infos:
if sensor.SensorType==u'Temperature':
print(sensor.Name)
print(sensor.Value)