mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Handled the case of an empty file (which apparently can crop up sometimes in unclean exits).
This commit is contained in:
parent
dec94a2ecf
commit
3f16003371
@ -76,10 +76,12 @@ class PickleBayesDB(plugins.DbiChannelDB):
|
||||
self.filename = filename
|
||||
self.nickFilename = self.filename.replace('pickle', 'nick.pickle')
|
||||
self.bayes = reverend.thomas.Bayes(tokenize)
|
||||
if os.path.exists(self.filename):
|
||||
if os.path.exists(self.filename) and \
|
||||
os.path.getsize(self.filename):
|
||||
self.bayes.load(self.filename)
|
||||
self.nickBayes = reverend.thomas.Bayes(tokenize)
|
||||
if os.path.exists(self.nickFilename):
|
||||
if os.path.exists(self.nickFilename) and \
|
||||
os.path.getsize(self.nickFilename):
|
||||
self.nickBayes.load(self.nickFilename)
|
||||
|
||||
def close(self):
|
||||
|
Loading…
Reference in New Issue
Block a user