what's wrong with the wmi.Terminate() method?

T

thunder54007

hi, here is my script:

import win32con
import time
import wmi
c = wmi.WMI()
for process in c.Win32_Process(name = "notepad.exe"):
print process.ProcessId, process.Name
process.Terminate ()

when I have only one notepad.exe process in my system, this works
fine,
but when I have more than one notepad.exe , after terminal the first
notepad.exe, the Terminate() for the second notepad.exe process will
generate the following error:

3156 notepad.exe
6100 notepad.exe
Traceback (most recent call last):
File "F:\thunder\python\program\wmi
\create_terminal_notepad.py", line 16, in
module>
process.Terminate ()
File "C:\Python25\Lib\site-packages\wmi.py", line 376, in __call__
handle_com_error (error_info)
File "C:\Python25\Lib\site-packages\wmi.py", line 188, in
handle_com_error
raise x_wmi, "\n".join (exception_string)
wmi.x_wmi: -0x7ffdfff7 - ·¢ÉúÒâÍâ(ps: exception happened)¡£
Error in: SWbemObjectEx
-0x7ffbeffe - ÕÒ²»µ½(ps:Can not found)


I don't know why this happend, is there somebody could give me a hand?
 
T

Tim Golden

(e-mail address removed) wrote:
[... snip same problem as reported to python-win32 ...]

See my reply on python-win32.

TJG
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top