用nohup重定向python輸出到文件不成功的解決辦法

原因是:

It looks like you need to flush stdout periodically (e.g. sys.stdout.flush()). In my testing Python doesn't automatically do this even with print until the program exits.
You can run Python with the -u flag to avoid output buffering

所以,

解決辦法之一:加-u

nohup python -u Bilstm-My-Exp-Char.py --training 1 --char_base 1 --window 5 --rnn_active relu --data_root ../../wangzhen/bilstm/ --load_embed 1 --model_pkl mdl5-15-14-30 > 5.txt 2>&1 &

解決辦法之二: sys.stdout.flush()



nohup sucks!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章