mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Fixed some exception handling madealios.
This commit is contained in:
parent
601ea799f3
commit
eadfd7141b
@ -292,12 +292,12 @@ class PeriodicFileDownloader(object):
|
|||||||
self.getFile(filename)
|
self.getFile(filename)
|
||||||
|
|
||||||
def _downloadFile(self, filename, url, f):
|
def _downloadFile(self, filename, url, f):
|
||||||
|
self.currentlyDownloading.add(filename)
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
infd = urllib2.urlopen(url)
|
infd = webutils.getUrlFd(url)
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
self.log.warning('Error downloading %s', url)
|
self.log.warning('Error downloading %s: %s', url, e)
|
||||||
self.log.exception('Exception:')
|
|
||||||
return
|
return
|
||||||
confDir = conf.supybot.directories.data()
|
confDir = conf.supybot.directories.data()
|
||||||
newFilename = os.path.join(confDir, utils.mktemp())
|
newFilename = os.path.join(confDir, utils.mktemp())
|
||||||
@ -334,7 +334,6 @@ class PeriodicFileDownloader(object):
|
|||||||
if time.time() - self.lastDownloaded[filename] > timeLimit and \
|
if time.time() - self.lastDownloaded[filename] > timeLimit and \
|
||||||
filename not in self.currentlyDownloading:
|
filename not in self.currentlyDownloading:
|
||||||
self.log.info('Beginning download of %s', url)
|
self.log.info('Beginning download of %s', url)
|
||||||
self.currentlyDownloading.add(filename)
|
|
||||||
args = (filename, url, f)
|
args = (filename, url, f)
|
||||||
name = '%s #%s' % (filename, self.downloadedCounter[filename])
|
name = '%s #%s' % (filename, self.downloadedCounter[filename])
|
||||||
t = threading.Thread(target=self._downloadFile, name=name,
|
t = threading.Thread(target=self._downloadFile, name=name,
|
||||||
|
Loading…
Reference in New Issue
Block a user