diff options
-rwxr-xr-x | reduce.py | 2 | ||||
-rwxr-xr-x | segment.py | 9 |
2 files changed, 8 insertions, 3 deletions
@@ -57,5 +57,5 @@ if __name__ == '__main__': args = parser.parse_args() print(args) - iterateSubDirectory(args.origdir, args.destdir, args.level) + iterateSubDirectory(args.origdir, args.destdir, int(args.level)) print('done') @@ -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') |