I have a Python program that has several processes (currently only 2) and threads (2 per process). I would like to catch every exception and especially close my program purely on Ctrl + c, but I cannot get it to work. Every time an exception occurs, the program stops, but does not close correctly, leaving me with an unusable command line.
What I have tried so far in pseudo-code:
try: for process in processes: process.join() except: pass
But, as I said, no luck. Also note that I am getting an Exception error for both processes, so they are both paused, I suppose?
Maybe I should also mention that most threads are blocked while listening to the channel.
EDIT So I almost made it. I needed to try: each thread and make sure the threads are connected correctly. There is only one drawback when shutting down: Exception KeyboardInterrupt in <module 'threading' from '/usr/lib64/python2.7/threading.pyc'> ignored . This rises in the main theme of the main process. This thread has already completed, that is, it has passed the last line of code.
Nobody
source share