1

I am working on a small project to get the cpu temperature on my windows machine. I settled on using the wmi module and have come across a snippet of code on the question link below and it was working at first but all of a sudden it would stop printing out the results and it seems like OpenHardwareMonitor is not reporting back to the wmi module.

Accessing CPU temperature in python

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) 

Thank you in advance for the help.

cdw100100
  • 192
  • 1
  • 13

1 Answers1

0

I resolved the problem and the code started to work correctly by going from OpenHardwareMonitor version 0.4.0 to version 0.4.0.3

cdw100100
  • 192
  • 1
  • 13