Seite 1 von 1

win32pdh

Verfasst: Mittwoch 28. September 2005, 13:11
von be_veronic
Hallo,

Ich habe ein Problem beim ausführen folgendes Skript:

Code: Alles auswählen

import win32pdh
object = 'Prozess'
items, instances = win32pdh.EnumObjectItems(None, None, object, 
                                               win32pdh.PERF_DETAIL_WIZARD)
instance_dict = {}
for instance in instances:
    try:
        instance_dict[instance] = instance_dict[instance] + 1
    except KeyError:
        instance_dict[instance] = 0
for instance, max_instances in instance_dict.items():
    for inum in xrange(max_instances+1):
        hq = win32pdh.OpenQuery()
        hcs = []
        for item in ['ID Process', 'Creating Process ID']:
            path = win32pdh.MakeCounterPath((None,object,instance,
                                            None,inum,item))
            hcs.append(win32pdh.AddCounter(hq,path))
        win32pdh.CollectQueryData(hq)
        print "%-15s\t" % (instance[:15]),
        for hc in hcs:
            type,val=win32pdh.GetFormattedCounterValue(hc,win32pdh.PDH_FMT_LONG)
            print "%5d" % (val),
            win32pdh.RemoveCounter(hc)
        print
        win32pdh.CloseQuery(hq)
        
Ich bekomme folgende Fehlermeldung:
hcs.append(win32pdh.AddCounter(hq , path))
error: (-1073738823, 'AddCounter', 'No error message is available')

Ich arbeite an einem Rechner mit Win2000 German darauf.
Weisst jemand wo das Problem liegt. Ich hab's in Netz gefunden dass es konnte von OS Spache abhängig sein.

Danke im voraus.

Edit (Leonidas): Code reformatiert und in Python-Tags gesetzt.

Verfasst: Donnerstag 29. September 2005, 15:25
von Leonidas
Was willst du denn eigentlich machen, vielleicht lässt es sich ja irgendwie anders lösen?