why? [win32com/WMI]

S

Sergey

import win32com.client

loc = win32com.client.Dispatch("WbemScripting.SWbemLocator")
svc = loc.ConnectServer("srv", "root/cimv2", "(e-mail address removed)", "******")
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
 
C

Claudio Grondi

Sergey said:
import win32com.client

loc = win32com.client.Dispatch("WbemScripting.SWbemLocator")
svc = loc.ConnectServer("srv", "root/cimv2", "(e-mail address removed)", "******")
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 have no idea what are you doing in your code or if the following has
something to do with your problem, but sometimes it good to know, that
Windows requires Unicode strings as parameter and giving full path file
names is always better than to rely on some default mechanisms.

Claudio
 
D

Dennis Lee Bieber

import win32com.client

loc = win32com.client.Dispatch("WbemScripting.SWbemLocator")
svc = loc.ConnectServer("srv", "root/cimv2", "(e-mail address removed)", "******")
sys = svc.get("Win32_Process")

I doubt it's the problem, but "sys" is probably not the best name to
use... It shadows the Python sys module...
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,285
Messages
2,571,416
Members
48,109
Latest member
AndresQlb

Latest Threads

Top