Re: killing process in windows

2005-06-09 Thread Veronica Tomescu
Hi Mick,
 
Thanks for your reply.It works fine until killing the process.Wmplayer is started,I can see the process in the task manager list,I also tried with notepad and it's the same problem.
I appreciate if you can help.
Vero
Trent Mick <[EMAIL PROTECTED]> wrote:
[Miki Tebeka wrote]> Hello Veronica,> > > I am using Trent's process.py but I have a problem with killing the> > processes in windows.> > For example :> > > > import process,time> > > > p=process.ProcessOpen('C:\Program Files\Windows Media> > Player\wmplayer')> > time.sleep(3)> > p.kill()> > > > will start Media Player without terminating it.> > Any suggestions?> A brutal way will be to use win32process.TerminateProcess (from win32all> package - http://starship.python.net/crew/mhammond/).Miki, actually my process.py *is* using TerminateProcess under the hoodhere.Veronica,Sorry, I really don't know what might be causing the problem here. Doesyour little snippet work properly for other applicati!
 ons like,
 say,Notepad, iexplore.exe, Word?Note that I'm am going to put the path in a list to be sure that the itgets quoted properly. It *might* be correct as just a string (as you hadit) but I'd have to check.If you do this in the interactive shell (don't quit the shell):>>> import process>>> p = process.ProcessOpen(["C:\Program Files\Windows Media Player\wmplayer"])Does media player start? Is there a "wmplayer.exe" is the process list(press Ctrl+Esc to open Task Manager)?Now try this is the same interactive shell:>>> p.kill()Trent-- Trent Mick[EMAIL PROTECTED]__Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- 
http://mail.python.org/mailman/listinfo/python-list

Re: killing process in windows

2005-06-09 Thread Trent Mick
[Miki Tebeka wrote]
> Hello Veronica,
> 
> >I am using Trent's process.py but I have a problem with killing the
> >processes in windows.
> >For example :
> > 
> >import process,time
> > 
> >p=process.ProcessOpen('C:\Program Files\Windows Media
> >Player\wmplayer')
> >time.sleep(3)
> >p.kill()
> > 
> >will start Media Player without terminating it.
> >Any suggestions?
> A brutal way will be to use win32process.TerminateProcess (from win32all
> package - http://starship.python.net/crew/mhammond/).

Miki, actually my process.py *is* using TerminateProcess under the hood
here.

Veronica,
Sorry, I really don't know what might be causing the problem here. Does
your little snippet work properly for other applications like, say,
Notepad, iexplore.exe, Word?

Note that I'm am going to put the path in a list to be sure that the it
gets quoted properly. It *might* be correct as just a string (as you had
it) but I'd have to check.

If you do this in the interactive shell (don't quit the shell):

>>> import process
>>> p = process.ProcessOpen(["C:\Program Files\Windows Media 
Player\wmplayer"])

Does media player start? Is there a "wmplayer.exe" is the process list
(press Ctrl+Esc to open Task Manager)?

Now try this is the same interactive shell:

>>> p.kill()

Trent

-- 
Trent Mick
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: killing process in windows

2005-06-09 Thread Miki Tebeka
Hello Veronica,

>I am using Trent's process.py but I have a problem with killing the
>processes in windows.
>For example :
> 
>import process,time
> 
>p=process.ProcessOpen('C:\Program Files\Windows Media
>Player\wmplayer')
>time.sleep(3)
>p.kill()
> 
>will start Media Player without terminating it.
>Any suggestions?
A brutal way will be to use win32process.TerminateProcess (from win32all
package - http://starship.python.net/crew/mhammond/).

HTH.
--

Miki Tebeka <[EMAIL PROTECTED]>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys


pgpwnvizK9j8w.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

killing process in windows

2005-06-08 Thread Veronica Tomescu

Hi,
 
I am using Trent's process.py but I have a problem with killing the processes in windows.
For example :
 
import process,time
 
p=process.ProcessOpen('C:\Program Files\Windows Media Player\wmplayer')time.sleep(3)p.kill()
 
will start Media Player without terminating it.
Any suggestions?
Thanks in advance.
Veronica
		Discover Yahoo! 
Get on-the-go sports scores, stock quotes, news & more. Check it out!-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Killing process

2005-05-18 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-05-01 05:07:27 -0700:
> I actually tried mapping the PID to an integer value and it still
> didn't work. At any rate, I found another way to do it. Thanks anyways.

What the kind people have been trying to get through is that the
win32api.TerminateProcess() does *NOT* take a pid (whether integer
or numeric string).

Got it?

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Killing process

2005-05-02 Thread Peter Hansen
Harlin Seritt wrote:
> I actually tried mapping the PID to an integer value and it still
> didn't work. At any rate, I found another way to do it. Thanks anyways.

For those who might follow in your footsteps, it might be nice to 
describe your solution...  (and to reduce the likelihood somebody will 
have to spend time repeating all those links and ideas again...)

Thanks,
-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Killing process

2005-05-01 Thread Harlin Seritt
I actually tried mapping the PID to an integer value and it still
didn't work. At any rate, I found another way to do it. Thanks anyways.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Killing process

2005-04-30 Thread Peter Hansen
Harlin Seritt wrote:
I think I need something besides TerminateProcess(). Is there anyway
possible to terminate a process by just passing a string value to the
function? Honestly, I am not interesting in terminating a process by
its handle.
This is a bizarre request.  Why can't you just call int() as you did in 
your example to turn the string into a number?  And if you can do that, 
why would you have a problem using the *defined mechanism* to convert 
from a PID to a handle, which is what the Windows API routine to kill 
processes requires?

-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: Killing process

2005-04-29 Thread Harlin Seritt
I think I need something besides TerminateProcess(). Is there anyway
possible to terminate a process by just passing a string value to the
function? Honestly, I am not interesting in terminating a process by
its handle.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Killing process

2005-04-29 Thread Peter Hansen
Harlin Seritt wrote:
I am using os.getpid() to get the pid value for a script running. I
store that value (as a string) to a file. Later when I try to kill that
pid (i pull this from the file as a string value) I get  errors.
[...]
  File "vngconsole.py", line 27, in StopVngSvc
win32api.TerminateProcess(int(pid), 0)
error: (6, 'TerminateProcess', 'The handle is invalid.')
I believe the problem is you are assuming TerminateProcess() takes a 
PID, when in fact it takes a "handle".  See this recipe for some hints: 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/347462
and 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp
to learn more about the key function you're missing.

-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Re: Killing process

2005-04-29 Thread Harlin Seritt
Yeah I've kind of figured that. I was just wanting to know what I could
use to kill a pid that is a string value. Thanks though.

Harlin

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Killing process

2005-04-29 Thread Roger Upole
TerminateProcess takes a process handle, not a pid.
win32api.OpenProcess will give you a handle.

 Roger

"Harlin Seritt" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I am using os.getpid() to get the pid value for a script running. I
> store that value (as a string) to a file. Later when I try to kill that
> pid (i pull this from the file as a string value) I get  errors.
>
> Using the following lines I get the subsequent error.
>
> (pid is a string value)
> win32api.TerminateProcess(int(pid), 0)
>
> OR
>
> ctypes.windll.kernel32.TerminateProcess(int(pid), 0)
>
> Errors:
>
> Exception in Tkinter callback
> Traceback (most recent call last):
>  File "C:\Python23\lib\lib-tk\Tkinter.py", line 1345, i
>return self.func(*args)
>  File "vngconsole.py", line 27, in StopVngSvc
>win32api.TerminateProcess(int(pid), 0)
> error: (6, 'TerminateProcess', 'The handle is invalid.')
>
> How exactly do I kill a pid using a string value?
> 




== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 
Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
-- 
http://mail.python.org/mailman/listinfo/python-list


Killing process

2005-04-29 Thread Harlin Seritt
I am using os.getpid() to get the pid value for a script running. I
store that value (as a string) to a file. Later when I try to kill that
pid (i pull this from the file as a string value) I get  errors.

Using the following lines I get the subsequent error.

(pid is a string value)
win32api.TerminateProcess(int(pid), 0)

OR

ctypes.windll.kernel32.TerminateProcess(int(pid), 0)

Errors:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python23\lib\lib-tk\Tkinter.py", line 1345, i
return self.func(*args)
  File "vngconsole.py", line 27, in StopVngSvc
win32api.TerminateProcess(int(pid), 0)
error: (6, 'TerminateProcess', 'The handle is invalid.')

How exactly do I kill a pid using a string value?

-- 
http://mail.python.org/mailman/listinfo/python-list