diff options
author | Peng Wu <alexepico@gmail.com> | 2011-07-18 17:09:38 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-07-18 17:09:38 +0800 |
commit | c60c7a70e1af20ee46f57817137df980b6392133 (patch) | |
tree | 21d8798113fd13db4979944afa031d344be6dfb5 /segment.py | |
parent | 073f8d930c94a2209ddab12f2cd44f4ae05bbffd (diff) | |
download | trainer-c60c7a70e1af20ee46f57817137df980b6392133.tar.gz trainer-c60c7a70e1af20ee46f57817137df980b6392133.tar.xz trainer-c60c7a70e1af20ee46f57817137df980b6392133.zip |
clean up zero length segment report
Diffstat (limited to 'segment.py')
-rwxr-xr-x | segment.py | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -25,13 +25,16 @@ def segmentOneText(infile, outfile, reportfile): return #begin processing - cmdline = './ngseg <"' + infile + '" 2>"' + reportfile + '"' - subprocess = Popen(cmdline, shell=True, stdout=PIPE, \ + cmdline = './ngseg <"' + infile + '" >"' + outfile + '"' + subprocess = Popen(cmdline, shell=True, stderr=PIPE, \ close_fds=True) - with open(outfile, 'wb') as f: - f.writelines(subprocess.stdout.readlines()) - f.close() + data = ''.join(subprocess.stderr.readlines()) + if data: + print('found error report') + with open(reportfile, 'wb') as f: + f.writelines([data]) + f.close() os.waitpid(subprocess.pid, 0) #end processing @@ -61,7 +64,7 @@ def handleOneIndex(indexpath): indexfile.close() #end processing - utils.sign_epoch(indexstatus) + utils.sign_epoch(indexstatus, 'Segment') utils.store_status(indexstatuspath, indexstatus) def walkThroughIndex(path): |