Problem listing services with wmi

Jean-Sébastien Guay jean_seb at videotron.ca
Mon May 16 16:20:44 EDT 2005


Hello Larry,

>Might not be the problem but try without the leading
>spaces before your method calls.
>
>for s in c.Win32_Service ():
>
>should be
>
>for s in c.Win32_Service():
>  
>

No change. For reference, the reason I know it's the c.Win32_Service() 
call that's throwing the exception is that if I try to run this :

import wmi
import pythoncom

pythoncom.CoInitialize()
c = wmi.WMI()
services = c.Win32_Service()
for s in services :
  print s.Caption, s.State

the exception gets thrown on the "services = ..." line.

Out of curiosity, is there any reason why whitespace between the method 
name and parameter list parentheses isn't good? Because the code I 
posted before was copy-pasted from Tim Golden's site 
(http://tgolden.sc.sabren.com/python/wmi.html) and the spaces were there.

Thanks,

J-S

-- 
___________________________________________
Jean-Sébastien Guay   jean_seb at videotron.ca
             http://whitestar02.webhop.org/




More information about the Python-list mailing list