Re: Repeating Thread Error

2007-07-06 Thread jimxu
hmm.. why use while True? After 5 secs, the function is going to run. so

t = threading.Thread(5.0, func)
t.start()

should just work. Put it in a infinite loop will start the thread and  
then start a the stopped thread... forever.

Jim


On Jul 6, 2007, at 2:40 PM, Jonathan Shan wrote:

> Hello,
>
> I am trying to call a function every 5 seconds. My understanding of
> time.sleep() is during the sleep time everything "stops". However, in
> my application, there are background processes that must be running
> continuously during the five second interval. Thus, threading.Timer
> seems like a good function. Here is the relevant code:
>
> # background processes
> t = threading.Timer(5.0, function_name, [arguments])
> while True:
>  # Do background processes run inside while loop?
>  t.start()
>
> The above code generates an error:
> AssertionError: thread already started
>
> Any hints on how to fix the error? Also, do background processes run
> inside while loops?
>
> Thanks in advance,
> Jonathan Shan
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what is wrong with that r"\"

2007-07-08 Thread jimxu
Yeah, that's a good point...


On Jul 8, 2007, at 1:48 AM, Tim Roberts wrote:

> i3dmaster <[EMAIL PROTECTED]> wrote:
>>
>> Then you can use other chars as the delimiter, [EMAIL PROTECTED]@b@ or 
>> r!a!b!,
>> etc... The import thing is so long as the interpreter doesn't get
>> confused on the data and the delimiter.
>
> That limits the number of valid delimiters to a relatively small  
> set.  You
> couldn't use any valid operator:
>
>x = r*a*b
>
> Is that a one character raw string appended to a string called "b",  
> or is
> that to multiplications?
>
>> sed also allows for
>> arbitrary delimiters too as long as you maintain the integrity of the
>> original meaning...
>
> sed can do that because its commands are one character long.  Whatever
> follows an "s" must a delimiter because it can't be anything else.
> -- 
> Tim Roberts, [EMAIL PROTECTED]
> Providenza & Boekelheide, Inc.
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list