[Teammetrics-discuss] Any luck with mbox-converter (Was: Converter for mboxes)

Alexander Wirt formorer at formorer.de
Thu Sep 22 16:57:09 UTC 2011


Andreas Tille schrieb am Thursday, den 22. September 2011:

> Hi again,
> 
> any problem publishing the code somehow?
I have currenty better things to do. Such things happen and anyhow its a
pretty simple 3 line diff or so:

--- mboxfilter.py	2011-09-20 06:32:10.000000000 +0000
+++ /home/formorer/bin/mboxfilter	2011-09-20 07:13:52.000000000 +0000
@@ -12,6 +12,7 @@
 
 import sys
 import mailbox
+import re
 
 HEADERS = ('From',
            'Date',
@@ -45,7 +46,7 @@
 
 def main(mbox_file):
 
-    out_mbox = mbox_file + '.converted'
+    out_mbox = '/tmp/testdir/' + mbox_file + '.converted'
     mbox = open(out_mbox, 'w')
 
     with open(mbox_file) as f:
@@ -99,8 +100,9 @@
     # found at this point, simply exit. 
     msg_ids = []
     try:
-        with open('messageid') as f:
-            msg_ids = [line.strip() for line in f.readlines()]
+        with open(mbox_file + '.spam') as f:
+            for line in f.readlines():
+		msg_ids.append(re.split('\s+', line.strip())[1].strip('<>'))
     except IOError:
         sys.exit('Error: messageid file not found in current working directory')
 
Alex



More information about the Teammetrics-discuss mailing list