From ca8af1957af83b9e9095d06de7af3600d0f5771c Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 28 May 2012 10:50:45 +0200 Subject: [PATCH] Skip message when headers cannot be parsed due to a HeaderParseError --- parse | 3 +++ 1 file changed, 3 insertions(+) diff --git a/parse b/parse index a272673..4f5b4f2 100755 --- a/parse +++ b/parse @@ -180,6 +180,9 @@ for email_file in file_list: except UnicodeDecodeError: print "ERROR: Failed parsing %s, headers could not be decoded." % sha1_hash continue + except email.errors.HeaderParseError: + print "ERROR: Failed parsing %s, headers could not be parsed." % sha1_hash + continue cursor.execute("INSERT INTO emails VALUES (?, ?, ?, ?, ?, ?, ?, ?)", new_row) print "Successfully parsed and inserted e-mail with SHA1 hash %s." % sha1_hash