python - urllib freeze if url is too big ! -


ok im trying open url using urllib problem file big, when open url python freezes, im using wxpython freezes when open url cpu goes 100% when url opened

any solutions ? there way can open url in chunks , maybe have time.sleep(0.5) in there not freeze ? code :

f = open("hello.txt",'wb') datatowrite = urllib.urlopen(link).read() f.write(datatowrite) f.close() 

thanks

you want split download separate thread, ui thread continues work while download thread work separately. way don't "freeze" while download happens.

read more threading here:

http://docs.python.org/library/threading.html

alternatively, use system download file outside of python using curl or wget.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -