diff options
author | Peng Wu <alexepico@gmail.com> | 2011-07-21 11:23:26 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-07-21 11:23:26 +0800 |
commit | eea694d78b09818af1d3bba432bfa97262db8c2a (patch) | |
tree | ba8b006d9ca492717a33f4768b3948369ec6d242 /segment.py | |
parent | 6bbdcff2c292258572072d01d9e170a298798513 (diff) | |
download | trainer-eea694d78b09818af1d3bba432bfa97262db8c2a.tar.gz trainer-eea694d78b09818af1d3bba432bfa97262db8c2a.tar.xz trainer-eea694d78b09818af1d3bba432bfa97262db8c2a.zip |
refine segment.py
Diffstat (limited to 'segment.py')
-rwxr-xr-x | segment.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -26,10 +26,15 @@ def segmentOneText(infile, outfile, reportfile): return #begin processing - cmdline = './ngseg <"' + infile + '" >"' + outfile + '"' - subprocess = Popen(cmdline, shell=True, stderr=PIPE, \ + cmdline = './ngseg >"' + outfile + '"' + subprocess = Popen(cmdline, shell=True, stdin=PIPE, stderr=PIPE, \ close_fds=True) + with open(infile, 'rb') as f: + subprocess.stdin.writelines(f.readlines()) + subprocess.stdin.close() + f.close() + lines = subprocess.stderr.readlines() if lines: print('found error report') |