urllib download insanity

Timothy Smith timothy at open-networks.net
Thu May 12 01:47:58 EDT 2005


ok what i am seeing is impossible.
i DELETED the file from my webserver, uploaded the new one. when my app 
logs in it checks the file, if it's changed it downloads it. the 
impossible part, is that on my pc is downloading the OLD file i've 
deleted! if i download it via IE, i get the new file. SO, my only 
conculsion is that urllib is caching it some where. BUT i'm already 
calling urlcleanup(), so what else can i do?
here is the code

LastModified = urllib2.urlopen('http://x.x.x.x/library.zip')
            LastModified = LastModified.headers['Content-Length']

            LocalFile = os.stat('library.zip')
            LocalFile = int(LocalFile.st_size)


            if LocalFile != int(LastModified):
                urllib.urlcleanup()
                
urllib.urlretrieve('http://x.x.x.x/library.zip','library.zip')

as a test i got someone in the office to login and try it - worked 
properly for them. i'm on a different ISP to them however, so my other 
idea is that possibly my isp has a transparent proxy setup that urllib 
is using, but IE isn't???



More information about the Python-list mailing list