close log file handle before move it.

This commit is contained in:
zhuangzhuang1988 2019-07-01 10:53:12 +08:00
parent cf46eaeac8
commit 99cb088708

View File

@ -57,12 +57,13 @@ def setup_logging_logfile(logfile):
)
logfile.setFormatter(logfile_formatter)
log.addHandler(logfile)
return logfile
def main():
setup_logging_console()
ctx = parse_flags()
setup_logging_logfile(ctx.log_file)
logfile = setup_logging_logfile(ctx.log_file)
if not ctx.linedata:
log.error("--linedata_only is required since only LSTM is supported")
sys.exit(1)
@ -78,6 +79,8 @@ def main():
phase_E_extract_features(ctx, ["--psm", "6", "lstm.train"], "lstmf")
make_lstmdata(ctx)
log.removeHandler(logfile)
logfile.close()
cleanup(ctx)
log.info("All done!")
return 0