[Tutor] TimeOut in

Alan Gauld alan.gauld at btinternet.com
Sun Nov 8 18:17:41 CET 2009


"somnath chakrabarti" <chakrabarti.somnath at gmail.com> wrote

> Below is the code that I have written to do the timeout implementation. 
> But
> I am getting error as follows. Can anybody please help me where I am 
> going
> wrong?

I have no idea how this framework is upposed to work but my
guess is that the problem lies here:

>    def getSolution(self,solver):
>        Problem.setSolver(self,solver)
>        self.p = threading.Timer(100, self.onTimeout())

Thios looks like you should be providing a callback
function self.onTimeout but you are calling the function
instead of referencing it. This calls the method before
self.p has been defined.

You need to remove the parentheses after Timeout.

I think...

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 




More information about the Tutor mailing list