Created
January 11, 2016 17:06
-
-
Save nguyenkims/212042099c7e142ae0d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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