why? [win32com/WMI]

Tim Golden tim.golden at viacom-outdoor.co.uk
Wed Mar 1 11:38:19 EST 2006


[Sergey]

| import win32com.client
| 
| loc = win32com.client.Dispatch("WbemScripting.SWbemLocator")
| svc = loc.ConnectServer("srv", "root/cimv2", "Admin at zzz.ru", "******")
| sys = svc.get("Win32_Process")
| sys.create("notepad.exe")
| 
| =>
| 
| Traceback (most recent call last):
| File "remote.py", line 6, in ?
| sys.create("notepad.exe")
| TypeError: 'int' object is not callable 

I could explain (it's to do with the way in which
WMI method calls are set up) but I suggest you look at
this module <trumpet-blowing>:

http://timgolden.me.uk/python/wmi.html

which makes WMI much easier to work with.

Your example then becomes:

<code>
import wmi

c = wmi.WMI (computer="srv", user="Admin at zzz.ru", password="****")
pid, retval = c.Win32_Process.Create (CommandLine="notepad.exe")
</code>

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. 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
________________________________________________________________________



More information about the Python-list mailing list