windows script host and python

Don Dwiggins dwig at advancedmp.net
Mon Mar 19 19:53:45 CET 2001


Tim Roberts writes:
> "Alex Martelli" <aleaxit at yahoo.com> wrote:
>> 
>> Here, for example, is the "list all running processes" WMI scripting
>> example translated into Python:
>> 
>> from win32com.client import GetObject
>> 
>> processes = GetObject("winmgmts:{impersonationLevel=impersonate}").\
>> InstancesOf("Win32_process")
>> 
>> for process in processes:
>> print process.Name

> Cool!  Is this supposed to be NT-only?  It doesn't fly on my Win98 box.

Actually, it fails on my NT workstation also:

Traceback (most recent call last):
  File "<stdin>", line 3, in ?
  File "e:\python20\win32com\client\__init__.py", line 72, in GetObject
    return Moniker(Pathname, clsctx)    
  File "e:\python20\win32com\client\__init__.py", line 87, in Moniker
    moniker, i, bindCtx = pythoncom.MkParseDisplayName(Pathname)
pywintypes.com_error: (-2147221020, 'Invalid syntax', None, None)

Just FYI, I haven't tried to debug it.

-- 
Don Dwiggins                    "Solvitur Ambulando"
Advanced MP Technology
dwig at advancedmp.net





More information about the Python-list mailing list