Re: [Tutor] TimeOut in

2009-11-11 Thread OkaMthembo
Hi Somnath, I think the exception simply means that the thread object or class does not have a cancel function. maybe read docs on Python threads to see what functions can be called on those? On Sun, Nov 8, 2009 at 9:09 PM, somnath chakrabarti < chakrabarti.somn...@gmail.com> wrote: > Hi Alan, >

[Tutor] TimeOut in between threads

2009-11-08 Thread somnath chakrabarti
Hi Python Tutor members, I am learning the concept of threads in Python and trying to write a Python code that will start a thread (say t1) from main or any other thread and then t1 will call a certain function f1(). If the execution of function f1() takes more than a specified time (say 1000 secs

Re: [Tutor] TimeOut in

2009-11-08 Thread Alan Gauld
"somnath chakrabarti" 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: de

[Tutor] TimeOut in

2009-11-08 Thread somnath chakrabarti
Hi Python Tutor members, I have a requirement where I am trying to give a solution for Magic Square puzzle for sizes ranging from 3 to 5 and using different Solvers. I have the below MS class derived from Problem class which is defined in constraint.py. The Problem class has a method called getSol

Re: [Tutor] timeout a routine

2006-11-28 Thread arbaro arbaro
Thanks a lot Jordan, I have no experience with classes at all yet, so your example will give me a really nice startting point. On 11/28/06, Jordan Greenberg <[EMAIL PROTECTED]> wrote: > arbaro arbaro wrote: > > Hello, > > > Is there a way to run the command > > os.path.isdir("/mnt/server/fold

[Tutor] timeout a routine

2006-11-28 Thread arbaro arbaro
Hello, I have a small problem with accessing a directory that may or may not exist. - The program runs from a Linux OS. (though this shouldn't matter) - A mountpoint /mnt/server may have been made to a windows server with samba. I would like to find out if a folder on the server is reachable (eg

Re: [Tutor] timeout

2006-01-16 Thread Alan Gauld
> how can I break a loop after a certain amount of time has passed? > with timeout of 60sec: I assume you want the loop to do somerthing until the timeout? If so then the logic is: timeout = now() + 60 while now() < timeout: do something. Using the time module you can easily calculate timeo

Re: [Tutor] timeout

2006-01-16 Thread Hugo González Monteverde
Hi Frank, > how can I break a loop after a certain amount of time has passed? > If the loop actually does something, I've used time.time() in the past: start_time = time.time() timeout = 60 #seconds while True: do_something() if time.time() - start_time >= timeout: break

Re: [Tutor] timeout

2006-01-16 Thread Kent Johnson
If you just want a delay, as your empty loop pseudocode seems to do, use time.sleep() as Wim suggested. If you are processing in a loop and you want to stop processing after a certain amount of time, you could check time.time() each time through the loop and end when the allotted time has elaps

Re: [Tutor] timeout

2006-01-16 Thread Rinzwind
Hello,With the time module and sleep(60)?http://www.python.org/doc/2.3.5/lib/module-datetime.html sleep( secs) Suspend execution for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep time. The actual suspension time may be less than that re

Re: [Tutor] timeout

2006-01-16 Thread frank h.
Hello how can I break a loop after a certain amount of time has passed? pseudocode: with timeout of 60sec: while True: pass is there a simple way? without resorting to queues etc. (this is a bit over my head) thanks for any insight you might have -frank On 1/16/06, frank h. <[E

[Tutor] timeout

2006-01-16 Thread frank h.
Hello how can I break a loop after a certain amount of time has passed? pseudocode: with timeout of 60sec: ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor