Skip to content

Instantly share code, notes, and snippets.

@nguyenkims
Created January 11, 2016 17:06
Show Gist options
  • Save nguyenkims/212042099c7e142ae0d2 to your computer and use it in GitHub Desktop.
Save nguyenkims/212042099c7e142ae0d2 to your computer and use it in GitHub Desktop.
"""
To debug the program, send the SIGUSR2 to the PID. You can find the PID by using 'ps aux | grep python'
kill -SIGUSR2 {PID}
"""
import signal
import pdb
def open_debug(sig, frame):
print 'sig', sig
pdb.set_trace()
signal.signal(signal.SIGUSR2, open_debug)
# a long-running example
import time
while True:
print("sleep now")
time.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment