A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/109201.html below:

Problem with trapping SIGALRM

Problem with trapping SIGALRM Problem with trapping SIGALRMChung Kuo bnewell at linux.chungkuo.org
Sat Apr 28 14:50:15 EDT 2001
I'm having some difficulty with an alarm() situation.  Here is what I tried:

import os, sys, signal

if __name == __main__:
	try:
		signal.alarm(60)
		os.system('/usr/games/quill')
	except:
		os.system('killall quill')

This fails when the alarm goes off because the except doesn't catch the
SIGALRM.  If I add a signal(signal.SIGALRM, handler) the handler of course
catches the SIGALRM, but doesn't process it until AFTER the os.system
call (usr/games/quill) completes!  (The docs seem to imply this, that 
handlers only operate between Python atomic operations.)

Can anyone say what I've got wrong here or suggest a way to do what I
am trying to do?

Thanks in advance.


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4