#import urllib import urllib2 import os link = "http://forum.tinycorelinux.net/Themes/tinycore/images/smflogo.png" fname="smflogo.png" print "opening url:", link #site = urllib.urlopen(link) #meta = site.info() #site.close() #length=int(meta.getheaders("Content-Length")[0]) #print "Content-Length:", length if os.path.exists(fname): start=os.path.getsize(fname) hf=open(fname,"a") else: start=0 hf=open(fname,"w") print "start:",start step=(1024*8)-1 end=start+step req = urllib2.Request(link) f = urllib2.urlopen(req) meta= f.info() length=int(meta.getheaders("Content-Length")[0]) f.close() if end > length: end= length while(start=length: end=length print start,"/",length,"%:",(start/(length*1.000))*100 except Exception as e: print "failed",e hf.close()