Hi, Chris & Marko

Thanks for your reply.

I find the reason why my time.sleep take longer time.
In my script, I use wxPython to build up my GUI, and I open another thread to 
do network communications.
It turned out that if you create a wx.Frame & make it show up, then your 
time.sleep may sleep longer time than expected.

I will dig deeper for the root cause. Anyway, it's interesting.

Here is a sample code that can reproduce this issue, you need to wait for it to 
run for a while.
******************
import time
import threading
import wx

def sleep():
    while True:
        t = time.time()
        time.sleep(1)
        print "Actually sleep:", time.time() - t 


t1 = threading.Thread(target=sleep)
t1.start()

app =wx.App(False)
frame = wx.Frame(None, title="test")
frame.Show(True)
app.MainLoop()
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to