473,659 Members | 2,987 Online
Bytes | Software Development & Data Engineering Community
+ 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.ex e"):
print process.Process Id, process.Name
process.Termina te ()

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\pyt hon\program\wmi
\create_termina l_notepad.py", line 16, in
module>
process.Termina te ()
File "C:\Python25\Li b\site-packages\wmi.py ", line 376, in __call__
handle_com_erro r (error_info)
File "C:\Python25\Li b\site-packages\wmi.py ", line 188, in
handle_com_erro r
raise x_wmi, "\n".join (exception_stri ng)
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 2452
th**********@gm ail.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
5017
by: Al Wilkerson | last post by:
Quick question, does exceptions in Java by default terminate the main program? Thanks, -- Al
6
1568
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 test it and go further in VBscript. But my problem is when clicking on the button, that the VB code doesn't wait to get that value and continues directly, so the a=<%=totd%> line give 0 in stead of the real value. If i click a second time, i get...
11
2210
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 TerminateThread() Win32 API which is a brutal way to end a thread. Is there any other more gentle way to close a thread??? Bob Rock
1
1958
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 to terminate it immediately ?
3
5917
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 Information using the WMI Win32_process
0
1017
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) { res.AsyncWaitHandle.WaitOne(5000,false); if(res.IsCompleted == false) {
7
1728
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 program is supposed to display a message box stating that there is no more item in the combobox with OK button to be clicked as the only option and upon clicking OK, the program should terminate, i.e the program should check to ensure that the...
11
438
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 in nested loops in lieu of strdup(), to avoid freeing temporary vars until the end. Use would be like this:
66
3322
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
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8335
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7356
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.