You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/09/15 01:42:05 UTC

[incubator-ponymail-foal] branch master updated: Print and skip if a message in an mbox file is None

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new e1772f4  Print and skip if a message in an mbox file is None
e1772f4 is described below

commit e1772f4e42e8d3a6d5ccea23e8ae3cd409b65ef3
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 14 20:42:00 2021 -0500

    Print and skip if a message in an mbox file is None
---
 tools/import-mbox.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index 0db1a0a..07265ab 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -146,9 +146,11 @@ class SlurpThread(Thread):
                 block.release()
 
             stime = time.time()
+            tmpname = ""
             delete_file = False
             if imap:
                 imap4 = mla[2]
+                tmpname = "IMAP"
 
                 def mailgen(_list):
                     for uid in _list:
@@ -215,6 +217,9 @@ class SlurpThread(Thread):
 
             for key in messages.iterkeys():
                 message = messages.get(key)
+                if not message:
+                    self.printid("Message %u could not be extracted from %s, ignoring it" % (key, tmpname))
+                    continue
                 file = messages.get_file(key, True)
                 # If the parsed data is filtered, also need to filter the raw input
                 # so the source agrees with the summary info