472,146 Members | 1,198 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

Re: Bloody signal handling (in embedded Python code)

Right, I didn't realize before that Python interpreter has its own
signal handling routines.

Now I am able to handle signals in Python code, but it still barfs on exit:

import time
import signal
import sys

def userBreak(sigNum, execFrame):
print "Interrupted,,,"

def terminateRun(sigNum, execFrame):
print "SIGTERM received, terminating."

def test():
print "success"

if __name__ == "__main__":
signal.signal(signal.SIGTERM, terminateRun)
signal.signal(signal.SIGINT, userBreak)

The error:

( pressing Ctrl-C )
Exception exceptions.SystemExit: 2 in 'garbage collection' ignored
Fatal Python error: unexpected exception during garbage collection
So the real question is - how to exit cleanly from embedded Python code?
Jul 2 '08 #1
0 1047

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Gary Robinson | last post: by
2 posts views Thread by Bertram Scharpf | last post: by
2 posts views Thread by Lionel van den Berg | last post: by
7 posts views Thread by Stanley S | last post: by
reply views Thread by kiran kumar | last post: by
10 posts views Thread by subramanian | last post: by
reply views Thread by Marcin Krol | last post: by
reply views Thread by Marcin Krol | last post: by

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.