Importing WMI module into Python CGI script fails

Peter Hansen peter at
Sun Jul 20 21:15:00 CEST 2003

MK wrote:
> This is what I get back in browser's window:

Browser?  What are you trying to do, that runs Python code in the
browser window?  Try running your code directly instead of through
CGI and see what happens.  It's easier to debug that way.

>  C:\python\lib\site-packages\win32com\client\ in
> Moniker(Pathname='winmgmts:', clsctx=23)
> com_error: (-2147217405, 'OLE error 0x80041003', None, None)

The above two snippets suggest that you are trying to access some
COM object called "winmgmts:" but don't have permission.  I have
no idea about COM/ActiveX so I can't help, but perhaps someone
else can.  Searching on Google for the above error code gives
lots of results, including:

 In the call to pWbemServices->GetObject an error of 0x80041003 is
 returned which according to MSDN documentation is

   The current user does not have permission to perform the action

I'd suggest you (a) learn more about Python, since you don't seem
to know how to interpret error tracebacks, and (b) describe in more
detail what you are trying to accomplish, because the problem is
not with the "wmi" module per se, but at a lower level, and appears
to be related to your not having the correct user permissions for
the object you are accessing.

Sorry I can't help more.


More information about the Python-list mailing list