[Python-checkins] python/nondist/sandbox/spambayes split.py,1.3,1.4
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Thu, 22 Aug 2002 19:12:02 -0700
Update of /cvsroot/python/python/nondist/sandbox/spambayes
In directory usw-pr-cvs1:/tmp/cvs-serv23927
Modified Files:
split.py
Log Message:
Open files in binary mode. Else, e.g., about 400MB of Barry's python-list
corpus vanishes on Windows. Also use file.write() instead of print>>, as
the latter invents an extra newline.
Index: split.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/spambayes/split.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** split.py 20 Aug 2002 22:07:17 -0000 1.3
--- split.py 23 Aug 2002 02:11:57 -0000 1.4
***************
*** 77,83 ****
# Cruise
! bin1out = open(bin1, 'w')
! bin2out = open(bin2, 'w')
! infp = open(mboxfile)
mbox = mailbox.PortableUnixMailbox(infp, _factory)
--- 77,83 ----
# Cruise
! bin1out = open(bin1, 'wb')
! bin2out = open(bin2, 'wb')
! infp = open(mboxfile, 'rb')
mbox = mailbox.PortableUnixMailbox(infp, _factory)
***************
*** 87,91 ****
else:
outfp = bin2out
! print >> outfp, msg
outfp.close()
--- 87,93 ----
else:
outfp = bin2out
! astext = str(msg)
! assert astext.endswith('\n')
! outfp.write(astext)
outfp.close()