Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # this is from The Python
- # Standard Library by example
- # ISBN13: 9780321767349
- # this was written for signals in OSX
- # when you run this on a linux system it
- # asks for an integer and complains about
- # line 25.
- import signal
- def alarm_received(n, stack):
- return
- signal.signal(signal.SIGALRM, alarm_received)
- signals_to_names = dict(
- (getattr(signal, n), n)
- for n in dir(signal)
- if n.startswith('sig') and '_' not in n
- )
- for s, name in sorted(signals_to_names.items()):
- handler = signal.getsignal(s)
- if handler is signal.SIG_DFL:
- handler = 'SIG_DFL'
- elif handler is signal.SIG_IGN:
- handler = 'SIG_IGN'
- print '%-10s (%2d):' % (name, s), handler
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement