Write Anonymise output to .anon file, rather than the terminal

This commit is contained in:
gimick 2010-06-06 21:06:04 +01:00
parent fb51ea03f7
commit 38ad49bf38

View File

@ -4,6 +4,7 @@ import codecs
import Options
import HandHistoryConverter
import Configuration
import sys
(options, argv) = Options.fpdb_options()
config = Configuration.Config()
@ -27,6 +28,13 @@ else:
m = hhc.re_PlayerInfo.finditer(filecontents)
outfile = options.infile+".anon"
print "Output being written to", outfile
savestdout = sys.stdout
fsock = open(outfile,"w")
sys.stdout = fsock
players = []
for a in m:
players = players + [a.group('PNAME')]
@ -37,3 +45,7 @@ for i, name in enumerate(uniq):
filecontents = filecontents.replace(name, 'Player%d' %i)
print filecontents
sys.stdout = savestdout
fsock.close()