Importing WMI module into Python CGI script fails

MK MK at foo.com
Sun Jul 20 14:50:09 EDT 2003


"Peter Hansen" <peter at engcorp.com> wrote

[...]

Hello Peter! This is what I get back in browser's window:





com_error


Python 2.2.2: C:\python\python.exe
Sun Jul 20 20:45:23 2003

A problem occurred in a Python script. Here is the sequence of function
calls leading up to the error, in the order they occurred.

----------------------------------------------------------------------------
----

 C:\python\testcgi\index.pycgi
    2 import cgitb; cgitb.enable()

    3 import wmi [MK comment: this line colored with a bright color!]

    4 import sys

    5

    6 cgi.test()

wmi undefined

----------------------------------------------------------------------------
----

 C:\python\testcgi\wmi.py
  114 # Do just enough to ensure constants are available

  115 #

  116 obj = win32com.client.GetObject ("winmgmts:")  [MK comment: colored
with a bright color!]

  117 win32com.client.gencache.EnsureDispatch (obj._oleobj_)

  118 del obj

obj undefined, win32com = <module 'win32com' from
'C:\python\lib\site-packages\win32com\__init__.pyc'>, win32com.client =
<module 'win32com.client' from
'C:\python\lib\site-packages\win32com\client\__init__.pyc'>,
win32com.client.GetObject = <function GetObject at 0x00A42DA8>

----------------------------------------------------------------------------
----

 C:\python\lib\site-packages\win32com\client\__init__.py in
GetObject(Pathname='winmgmts:', Class=None, clsctx=23)
   71     return GetActiveObject(Class, clsctx)

   72   else:

   73     return Moniker(Pathname, clsctx)     [MK comment: colored with a
bright color!]

   74

   75 def GetActiveObject(Class, clsctx = pythoncom.CLSCTX_ALL):

global Moniker = <function Moniker at 0x00A3D210>, Pathname = 'winmgmts:',
clsctx = 23

----------------------------------------------------------------------------
----

 C:\python\lib\site-packages\win32com\client\__init__.py in
Moniker(Pathname='winmgmts:', clsctx=23)
   86     Python friendly version of GetObject's moniker functionality.

   87   """

   88   moniker, i, bindCtx = pythoncom.MkParseDisplayName(Pathname)

   89   dispatch = moniker.BindToObject(bindCtx, None,
pythoncom.IID_IDispatch)

   90   return __WrapDispatch(dispatch, Pathname, clsctx = clsctx)

moniker undefined, i undefined, bindCtx undefined, global pythoncom =
<module 'pythoncom' from 'C:\WINNT\System32\pythoncom22.dll'>,
pythoncom.MkParseDisplayName = <built-in function MkParseDisplayName>,
Pathname = 'winmgmts:'


com_error: (-2147217405, 'OLE error 0x80041003', None, None)
      __doc__ = None
      __getitem__ = <bound method com_error.__getitem__ of
<pywintypes.com_error instance at 0x005A72E0>>
      __init__ = <bound method com_error.__init__ of <pywintypes.com_error
instance at 0x005A72E0>>
      __module__ = 'pywintypes'
      __str__ = <bound method com_error.__str__ of <pywintypes.com_error
instance at 0x005A72E0>>
      args = (-2147217405, 'OLE error 0x80041003', None, None)







More information about the Python-list mailing list