> Now when I put "proc.terminate()" in my signal_handler() function to > terminate the subprocess created as well, > It is giving me "WindowsError: [Error 5] Access is denied" error. > I have tried with os.kill() also, same error. Tried with Popen.kill() also > same error. Have googled a bit but couldn't understand them. > > In general, How to kill a subprocesses created from a python program.? If > that subprocess also creates a new process from itself, how can I kill all > child processes from my main python script.?
I have not tested this, but you could get the pid by doing Popen.pid and then killing it from the command line by doing "taskkill /PID [pid]". This is all dependant on the users ability to kill the task in the first place. If that does not work then the problem is probably not Python but Windows. You could test by running your program and doing the taskkill in a separate command prompt. Hope that helps, Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 5423 -- This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. -- http://mail.python.org/mailman/listinfo/python-list