diff options
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') |