[python-win32] Finding installed softwares on the remote mach ine using WMI

Anthony Catalfo apc1964 at yahoo.com
Tue Jul 8 09:27:09 EDT 2003


this code works great on my xp machine and on one of
my 2000 machines but fails on another 2000 machine
with these errors.


PythonWin 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32
bit (Intel)] on win32.
Portions Copyright 1994-2001 Mark Hammond
(mhammond at skippinet.com.au) - see 'Help/About
PythonWin' for further copyright information.
>>> SELECT * FROM __InstanceCreationEvent WITHIN 2
WHERE TargetInstance ISA 'Win32_PrintJob' 
Traceback (most recent call last):
  File
"C:\Python22\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 310, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\python\f3.py", line 16, in ?
    delay_secs=2
  File "C:\python\wmi.py", line 365, in watch_for
    return _wmi_watcher
(self.wmi.ExecNotificationQuery (wql))
  File
"C:\Python22\lib\site-packages\win32com\gen_py\565783C6-CB41-11D1-8B02-00600806D9B6x0x1x1\ISWbemServices.py",
line 63, in ExecNotificationQuery
    return self._ApplyTypes_(15, 1, (9, 32), ((8, 1),
(8, 49), (3, 49), (9, 49)), 'ExecNotificationQuery',
'{27D54D92-0EBE-11D2-8B22-00600806D9B6}',strQuery,
strQueryLanguage, iFlags, objWbemNamedValueSet)
  File
"C:\Python22\lib\site-packages\win32com\client\__init__.py",
line 445, in _ApplyTypes_
    return
self._get_good_object_(apply(self._oleobj_.InvokeTypes,
(dispid, 0, wFlags, retType, argTypes) + args), user,
resultCLSID)
com_error: (-2147352567, 'Exception occurred.', (0,
'SWbemServices', 'Generic failure\r\n', None, 0,
-2147217407), None)
>>> 


any ideas why?

thanks
Anthony





--- Tim Golden <tim.golden at viacom-outdoor.co.uk>
wrote:
> Anthony Catalfo:
> 
> > Would you have an Idea how to use 
> 
> > FindFirstPrinterChangeNotification in python(to
> > monitor printer status) or how to use vb.net from
> > python?
> 
> I'm afraid the answer to both these questions 
>  is No, altho' the first is probably best answered
>  by looking at ctypes (there's a good worked example
>  at
>
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/208699);
> 
> and the second is slightly more vague: what exactly
> do
>  you mean by "use vb.net from python"? I suspect you
> 
>  mean that you've come across an example which does
>  what you want and which runs in VB.NET. If that is
> the
>  case then you're either going to have to translate
> it
>  into the equivalent Python (which is probably what
>  your first question's about) or find someone more
>  knowledgeable than I am about the .NET framework
> who
>  could talk about interoperation.
> 
> Meanwhile, the following snippet will watch for
> print
>  jobs using WMI. Hope it's of some use, if only as a
>  starting point:
> 
> #
> # uses the WMI module at
> http://tgolden.sc.sabren.com/python/wmi.html
> #
> 
> import wmi
> 
> c = wmi.WMI ()
> new_print_jobs = c.watch_for (
>   notification_type="Creation", 
>   wmi_class="Win32_PrintJob", 
>   delay_secs=1
> )
> while 1:
>   new_print_job = new_print_jobs ()
>   print new_print_job
> 
> TJG
> 
>
________________________________________________________________________
> This e-mail has been scanned for all viruses by Star
> Internet. The
> service is powered by MessageLabs. For more
> information on a proactive
> anti-virus service working around the clock, around
> the globe, visit:
> http://www.star.net.uk
>
________________________________________________________________________


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com



More information about the Python-win32 mailing list