Skip to content

Commit

Permalink
Try to catch problems with message processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
montanaro committed Sep 21, 2010
1 parent afef9e4 commit ca92e64
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spambayes/contrib/tte.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,12 @@ def train(store, hambox, spambox, maxmsgs, maxrounds, tdict, reverse, verbose,
sys.stdout.flush()

tokens = list(tokenize(train_msg))
score = store.spamprob(tokens)
selector = train_msg["message-id"] or train_msg["subject"]
try:
score = store.spamprob(tokens)
except UnicodeDecodeError:
print >> sys.stderr, "Unicode error while processing", selector
continue

if misclassified(train_spam, score) and selector is not None:
if verbose:
Expand Down

0 comments on commit ca92e64

Please sign in to comment.