hello all, i want to add a "new update notification" feature to my wxPython appl. The codes below do the job. The logic is simple enough, I don't think it needs to be explained.
since sometimes, under windows, proxy setting was a script. and was set in IE. In this case, connecting to the HTML will take relative long time. I therefore run the following codes in a new Thread (subclass of threading.Thread), so that user don't have to wait during the version checking period. Under Linux, it worked smoothly. But under Windows XP, it didn't. If there was new updates, the notification dialog can show, but no text, icon, .... on it. Then, the whole application didn't response any longer. :( I have to force stop the application process. where is the problem? Thanks. code to get the version from a HTML: def getLatestVersion(versionUrl): #proxy is only for testing # proxy_support = urllib2.ProxyHandler ({"http":"10.48.187.80:8080"}) # opener = urllib2.build_opener(proxy_support) # urllib2.install_opener(opener) #proxy is only for testing result = '' try: f = urllib2.urlopen(versionUrl) s = f.read() f.close() result = s.split("#xxx#")[1] except: pass return result Thread class: class UpdateChecker(Thread): def __init__(self): Thread.__init__(self) def run(self): lv = util.getLatestVersion(config.VERSION_URL) if lv>config.VERSION: showUpdateDialog(lv) codes to start the thread: updatechk = UpdateChecker() updatechk.start() -- http://mail.python.org/mailman/listinfo/python-list