[python-win32] Problem with OLE error 0x80041002

Tim Golden mail at timgolden.me.uk
Tue Dec 15 21:12:26 CET 2009


Gowtham wrote:
> Inline-
> 
> On Fri, Dec 11, 2009 at 9:16 AM, Tim Golden <mail at timgolden.me.uk> wrote:
> 
>> Gowtham wrote:
>>
>>> I have a python script that retrieves the user profile path from the
>>> registry using wmi. I am doing this way as win32net.NetUserGetInfo could
>>> not
>>> somehow find the domain user.  Here the code snippet-
>>>
>> {... snipped snippet ...]
>>
>> Does this reveal anything?
>>
>> <code>
>> import _winreg
>> import wmi
>>
>> reg = wmi.WMI (namespace="default").StdRegProv
>>
> WMI call still throws up the same exception of OLE error. WMI is somehow
> failing to get a handle.


I hadn't appreciated that it was failing here. I assumed that
it was down below where you try to access the registry keys.
If it can't even get to the WMI registry provider, it looks as
if the provider isn't installed (unlikely) or is somehow corrupt.

Can you attach to the "default" namespace at all?
(ie does this work):

wmi.WMI (namespace="default")

If not, what namespaces are there? If you have the most recent
WMI download from my site, there's a wmiweb.py which lets you
browse the WMI namespaces fairly easily.

TJG


More information about the python-win32 mailing list