[Spambayes-checkins] spambayes/Outlook2000/sandbox
extract_bad_msg_from_log.py, NONE, 1.1
Mark Hammond
mhammond at users.sourceforge.net
Tue Aug 19 07:32:31 EDT 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000/sandbox
In directory sc8-pr-cvs1:/tmp/cvs-serv30481
Added Files:
extract_bad_msg_from_log.py
Log Message:
Little hack of a tool to extract messages in an Outlook log file
to a message file.
--- NEW FILE: extract_bad_msg_from_log.py ---
# extract_bad_msg_from_log.py
import sys
def main(argv = None):
if argv is None: argv = sys.argv
if len(argv) < 2:
print "Need log filename"
return
f = open(argv[1])
trigger = "FAILED to create email.message from: "
quotes = "'\""
for line in f:
if line.startswith(trigger):
msg_repr = line[len(trigger):]
if msg_repr[0] not in quotes or msg_repr[-2] not in quotes:
print "eeek - not a string repr!"
return
msg_str = eval(msg_repr)
# damn it - stderr in text mode
msg_str = msg_str.replace("\r\n", "\n")
sys.stdout.write(msg_str)
inname = sys.argv[1]
if __name__=='__main__':
main()
More information about the Spambayes-checkins
mailing list