[python-win32] Problem with win32pdh.GetCounterInfo

Thomas HERVE therve at neocles.com
Wed Feb 25 04:54:44 EST 2004


I try to get some monitoring information on Windows Station. My 
installation is Windows Server 2003, in french.
I use python 2.3 and win32all-163.

Here is my script : 

>>> import win32pdh
>>> path = win32pdh.MakeCounterPath((None,"Processeur", "_Total", None, 
-1, "% Temps processeur"))
>>> base = win32pdh.OpenQuery()
>>> counter = win32pdh.AddCounter(base, path)
>>> win32pdh.GetCounterInfo(counter, 0)
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
error: (-2147481646, 'GetCounterInfo for size', 'No error message is 
available')

But if i do :
>>> win32pdh.CollectQueryData(base)
>>> win32pdh.CollectQueryData(base)
>>> win32pdh.GetFormattedCounterValue(hc,win32pdh.PDH_FMT_LONG)
(558957824, 6)

So my counter is "well formed".

I try to look into the sources but nothing seems to be incorrect to me. If 
there's any problem with it (maybe localisation ? I've seen lots of 
problem from this), please let me know. And if course you have one 
solution it's even better.

Thanks in advance,

-- 
Thomas Herve <excuse me for my clumsy english>



More information about the Python-win32 mailing list