RE: Problem listing services with wmi

2005-05-18 Thread Tim Golden
[Jean-Sébastien Guay] | Hi again Tim, Nice to hear back from you. | Any reason I should know about that you haven't updated to | 2.4? I just got into Python, so I got the latest version, but if there's | something wrong with 2.4 I'd like to know... No; there's no problem as such. At home, I'm

Re: Problem listing services with wmi

2005-05-18 Thread Jean-Sébastien Guay
Hi again Tim, >OK. I'm running 2.3 normally but I've run the scripts with >2.4 so I don't think it makes a difference. I'll leave the >set import logic in place so I don't have to remember. > > Any reason I should know about that you haven't updated to 2.4? I just got into Python, so I got the

RE: Problem listing services with wmi

2005-05-18 Thread Tim Golden
[... snip my comparison of win32service & WMI ...] | Seems like your hunch was right, the first loop completes correctly. | Adding a counter to both loops shows that getting services from | win32service.EnumServicesStatus() gets 108 services, and getting them | through WMI gets to 87 and then h

Re: Problem listing services with wmi

2005-05-17 Thread Jean-Sébastien Guay
Hi again Tim, >Well I honestly don't know if this will go any further, >but the following code uses the win32service module from >pywin32 to collect the service information, on the off-chance >that it *won't* fail where WMI does. I can't easily test it >since the script doesn't raise an error on m

RE: Problem listing services with wmi

2005-05-17 Thread Tim Golden
[... snip results ...] | So it would seem that the 3 methods give the same result. As to which | service it has gotten to when it gets to position 88 in the list, | obviously I can't find out with a script, and it seems that the list | isn't in any order I can see, so I couldn't even venture a

Re: Problem listing services with wmi

2005-05-17 Thread Jean-Sébastien Guay
Hello Tim, thanks for replying, >For your >information, what the code is doing behind the scenes is the following: > > > >import win32com.client > >c = win32com.client.GetObject ( > > "winmgmts:{impersonationLevel=Impersonate,authenticationLevel=Default}/root/cimv2" >) >for service in c.ExecQuer

RE: Problem listing services with wmi

2005-05-17 Thread Tim Golden
[Jean-Sébastien Guay] [... snip Larry Bates' suggestion of removing whitespace ...] | 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:/

RE: Problem listing services with wmi

2005-05-17 Thread Tim Golden
[Jean-Sébastien Guay] | | 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! | | import wmi | | c = wmi.WMI

Re: Problem listing services with wmi

2005-05-16 Thread Roger Upole
The only thing I could find for the hresult is that it corresponds to wbemErrCriticalError. According to this page http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wbemerrorenum.asp it's some kind of internal error. Roger "Jean-Sébastien Guay" <[EMAIL PROTECTE

Re: Problem listing services with wmi

2005-05-16 Thread Larry Bates
I guess I was wrong and it does work, but from Python Style Guide: Whitespace in Expressions and Statements Pet Peeves Guido hates whitespace in the following places: - Immediately before the open parenthesis that starts the argument list of a function call, as in "spam (1)". A

Re: Problem listing services with wmi

2005-05-16 Thread Jean-Sébastien Guay
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

Re: Problem listing services with wmi

2005-05-16 Thread Larry Bates
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(): -Larry Jean-Sébastien Guay wrote: > Hello, > > I'm pretty new to Python, though I have a fair bit of experience with > C/C++, Java, Perl, P