Hello, I'm pretty new to Python, though I have a fair bit of experience with C/C++, Java, Perl, PHP and others.
I installed Tim Golden's wmi module (http://tgolden.sc.sabren.com/python/wmi.html), in the hopes it would help me list and work with services on my Win32 machine. Now, everything seems fine except for one thing : Listing services! I tried running a couple of the examples on Tim's more examples page in the python shell (for example, List all running processes, Show the percentage free space for each fixed disk, Show the IP and MAC addresses for IP-enabled network interfaces, etc.) and they worked fine. But when I try to run the first example which is on the first page above, I get an error. The code is : import wmi c = wmi.WMI () for s in c.Win32_Service (): if s.State == 'Stopped': print s.Caption, s.State and I get : Traceback (most recent call last): File "<stdin>", line 1, in ? File "G:\Python-2.4\Lib\site-packages\wmi.py", line 404, in __call__ return self.wmi.query (wql) File "G:\Python-2.4\Lib\site-packages\wmi.py", line 583, in query raise WMI_EXCEPTIONS.get (hresult, x_wmi (hresult)) wmi.x_wmi: -2147217398 (the exception seems to be thrown on the "for s in..." line) I have only found one discussion in this newsgroup's archives that seems to talk about this problem (http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/19fa91ea1a1ff160/0364b7cd22d73483?q=WMI_EXCEPTIONS&rnum=1#0364b7cd22d73483) and the fix they suggest there (calling pythoncom.CoInitialize () before instantiating the WMI object) doesn't seem to work in this case. In other words, this code : import wmi import pythoncom pythoncom.CoInitialize () c = wmi.WMI () for s in c.Win32_Service (): if s.State == 'Stopped': print s.Caption, s.State gives me the same result as above. Could someone please point me in the right direction to find out what's wrong? Thanks in advance, J-S -- ___________________________________________ Jean-Sébastien Guay [EMAIL PROTECTED] http://whitestar02.webhop.org/ -- http://mail.python.org/mailman/listinfo/python-list