473,466 Members | 1,451 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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?
Jan 23 '08 #1
1 2425
th**********@gmail.com wrote:
[... snip same problem as reported to python-win32 ...]

See my reply on python-win32.

TJG
Jan 23 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Al Wilkerson | last post by:
Quick question, does exceptions in Java by default terminate the main program? Thanks, -- Al
6
by: Andre | last post by:
Hi, I need to fetch a value in an Access db, so i use a form to pass the parameter for the SQL statement fromVB client to ASP. After the submit line in VBscript, i expect the value in order to...
11
by: Bob Rock | last post by:
Hello, coming from win32 API I recall an ExitThread() call to gently terminate a thread from inside the same thread .... but now all I can see is an Abort call which seems to me a wrapper on the...
1
by: [Yosi] | last post by:
How to terminate immediately ? after mThread.Start(); ... I want to kill the thread , but mThread.Abort() don't terminate it immediately, still see that the process keep going. Is there any way...
3
by: Peter Neuburger via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Peter Neuburger Hi Everybody, I need some help with the WMI Terminate Method. I have a Listbox where I get all the Process...
0
by: Benoit Martin | last post by:
here is my code: //*** snippet start string arg = ""; WorkDelegate d = new WorkDelegate(Printing); IAsyncResult res = d.BeginInvoke(arg,null,null); if(res.IsCompleted == false) {...
7
by: Amanda | last post by:
User is going to be transferring items out of combobox to listbox and vice versa keeping ascending and desending order respectively at all time. If user selects the last item in combobox, the...
11
by: Tinkertim | last post by:
Hello, I've written a function similar to strdup(), except that realloc() is used and the # of characters written is returned instead of returning a cast value of memcpy(). I made this to use...
66
by: John | last post by:
Hi What are the advantages actually achieved of managed code? I am not talking of theory but in reality. Thanks Regards
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.