can't kill os.system process

david brochu jr brochu121 at gmail.com
Thu Jul 27 13:31:31 EDT 2006


When I run the following code:

import os

file = "C:\\progra~1\\mozill~1\\firefox.exe www.google.com"
os.system(file)
# this will spawn Firefox and naviage to google.com

kill = "taskkill /f /im firefox.exe"
os.system(kill)
          #
this should kill Firefox instance that was just spawned



the script never gets to kill the insance of firefox. When I manually close
Firefox, my cmd window indicates that the taskkill command was unsuccessful,
which leads me to believe that after I open Firefox the system is not
getting any indication that the command finished executing, which would
result in Firefox not being killed. I also tried substituting "os.system"
with "os.popen" which did the same thing.

Anyone have an idea how I can kill the instance of Firefox?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060727/048892c2/attachment.html>


More information about the Python-list mailing list