Re: Is there a better way to implement this:

2007-01-23 Thread Peter Otten
Paul Boddie wrote: > Michael Yanowitz wrote: >> >>I guess I am looking for something portable (both >> Windows and Linux) where I can abort a function after >> a certain time limit expires. > > Doing a search for "timeout function Python" on Google reveals a number > of approaches. > Using

Re: Is there a better way to implement this:

2007-01-22 Thread Paul Boddie
Michael Yanowitz wrote: > >I guess I am looking for something portable (both > Windows and Linux) where I can abort a function after > a certain time limit expires. Doing a search for "timeout function Python" on Google reveals a number of approaches. Using signals: * http://nick.vargish.o

RE: Is there a better way to implement this:

2007-01-22 Thread Michael Yanowitz
. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Benjamin Niemann Sent: Monday, January 22, 2007 11:19 AM To: python-list@python.org Subject: Re: Is there a better way to implement this: Michael Yanowitz wrote: > Hello: > >I wrote the code be

Re: Is there a better way to implement this:

2007-01-22 Thread Benjamin Niemann
ected - exceptions are local to a thread and there is currently no (portable) way to raise an exception in another thread. > What am I missing, or is there a better way to > implement this (having ftimed() return when the > abort-timer time is exceeded? You may use the signal.alarm() funct

Is there a better way to implement this:

2007-01-22 Thread Michael Yanowitz
tinue and not return? What am I missing, or is there a better way to implement this (having ftimed() return when the abort-timer time is exceeded? import time, thread, sys thread_finished = "MAX RUN TIME EXCEEDED!" def abort (seconds): start_time = time.time() wh