简体   繁体   中英

Which python module is used to read CPU temperature and processor Fan speed in WINDOWS..?

Which python module is used to read CPU temperature and processor Fan speed in WINDOWS..?

Explored WMI python module, how ever i am unable to find the correct option or function to capture the above mentioned info.

Actually i tried the follwoing code snip, but it returns 'nothing'.

import wmi
w = wmi.WMI()
print w.Win32_TemperatureProbe()[0].CurrentReading

Kindly give some suggestions to get those infos.

Br, -Srk

As per Microsoft's MSDN :

Most of the information that the Win32_TemperatureProbe WMI class provides comes from SMBIOS. Real-time readings for the CurrentReading property cannot be extracted from SMBIOS tables. For this reason, current implementations of WMI do not populate the CurrentReading property . The CurrentReading property's presence is reserved for future use.

You can use MSAcpi_ThermalZoneTemperature instead:

import wmi

w = wmi.WMI(namespace="root\\wmi")
print (w.MSAcpi_ThermalZoneTemperature()[0].CurrentTemperature/10.0)-273.15

This works perfectly:

import wmi

w = wmi.WMI(namespace="root\\wmi")
print (w.MSAcpi_ThermalZoneTemperature()[0].CurrentTemperature / 10.0) - 273.15

Make sure you're running the program as administrator, otherwise it will fail or give error codes when trying to test/run/execute your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM