On 16 Apr., 11:08, Piet van Oostrum <p...@cs.uu.nl> wrote: > >>>>> googler.1.webmas...@spamgourmet.com (g1w) wrote: > >g1w> hi, yes, thats true, Alan Touring told us, so it would be nice to let > >g1w> the user abort it. > >g1w> Is there a chance for windows, too? > > I don't know. I have no access to Python on Windows. Maybe there is > setitimer support on Windows. Or maybe you can use the threading.Timer > object, like this: > > import signal, os > import threading > > signalcode = signal.SIGALRM # on Windows, choose one that exists there. > > class AlarmError(Exception): > pass > > def interrupt(): > os.kill(os.getpid(), signalcode) > > def execute(command, timeout): > threading.Timer(timeout, interrupt).start() > try: > exec(command) > except AlarmError, e: > print e > print 'Aborted "%s"' % (command,) > print "continue work" > > print "The everlasting command" > execute("while 1: pass", 10) > print "The End" > > -- > Piet van Oostrum <p...@cs.uu.nl> > URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4] > Private email: p...@vanoostrum.org
thx, i will check... :) merci -- http://mail.python.org/mailman/listinfo/python-list