here is a quick python module I wrote to return a list of the current temperatures of the cores in a duel core processor computer. Works fine on my computer, not sure about other peoples. It is more efficient than it looks, as the the file it is reading is stored in a pseudo-filesystem which is in memory (at least I think so anyway)

temperature.py

def findtemperature():
    '''(c) 2009 Louis Taylor
       licensed under GPLv2

    returns an list of an integer for
    each processor in a duel-core computer, in Celcius.
    e.g. ['temperature for processor 0:', 38, 'temperature for processor 1:', 29]
    if your os != linux2 it will not work'''

    process1file=open('/proc/acpi/thermal_zone/TZS0/temperature', 'r')
    process1file=process1file.readlines()
    process1file=str(process1file)
    temp1=process1file.split()
    temp1=temp1[1]

    process2file=open('/proc/acpi/thermal_zone/TZS1/temperature', 'r')
    process2file=process2file.readlines()
    process2file=str(process2file)
    temp2=process2file.split()
    temp2=temp2[1]

    return list(['temperature for processor 0:',temp1, 'temperature for processor 1:', temp2])
Advertisements