Oops, didn't check to see if the file was there before stat'ing it.

This commit is contained in:
Jeremy Fincher 2003-10-08 14:15:05 +00:00
parent 8b7b4d97ac
commit 206e14fcf4

View File

@ -133,8 +133,11 @@ class PeriodicFileDownloader(object):
self.downloadedCounter = {} self.downloadedCounter = {}
for filename in self.periodicFiles: for filename in self.periodicFiles:
if self.periodicFiles[filename][-1] is None: if self.periodicFiles[filename][-1] is None:
fullPathname = os.path.join(conf.dataDir, filename) fullname = os.path.join(conf.dataDir, filename)
self.lastDownloaded[filename] = os.stat(fullPathname).st_ctime if os.path.exists(fullname):
self.lastDownloaded[filename] = os.stat(fullname).st_ctime
else:
self.lastDownloaded[filename] = 0
else: else:
self.lastDownloaded[filename] = 0 self.lastDownloaded[filename] = 0
self.currentlyDownloading = sets.Set() self.currentlyDownloading = sets.Set()
@ -143,7 +146,7 @@ class PeriodicFileDownloader(object):
def _downloadFile(self, filename, url, f): def _downloadFile(self, filename, url, f):
infd = urllib2.urlopen(url) infd = urllib2.urlopen(url)
newFilename = utils.mktemp() newFilename = os.path.join(conf.dataDir, utils.mktemp())
outfd = file(newFilename, 'wb') outfd = file(newFilename, 'wb')
start = time.time() start = time.time()
s = infd.read(4096) s = infd.read(4096)