thanks,
On 06-08-2010 15:37, sharpblade wrote:
> You are not using the WMI efficiently. You iterate over every process to test
> if only one is
> there, when you can use WMI like so:
>
> >>> import wmi
> >>> x = wmi.WMI()
> >>> x.query("SELECT * FROM Win32_Process WHERE Name = 'xchat.exe'")
> [<_wmi_object: \\TOM-PC\root\cimv2:Win32_Process.Handle="7052">]
> >>> def test():
> t1 = time.time()
> x.query("SELECT * FROM Win32_Process WHERE Name = 'xchat.exe'")
> print time.time()-t1
>
> >>> import time
> >>> test()
> 0.0829999446869
> >>>
>
but that looks quit more complicated than psutils,
besides that I believe that psutils is platform independant.
cheers,
Stef
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32