2009/7/13 Lily Gao <lily....@autodesk.com>:
> Hi, All
>
> I am calling a python program in perl and use redirection,
>
> Like :
>
> `python x.py > 1.log 2>&1`
>
> When x.py crash, I get nothing from 1.log, and if I don’t use redirection, I
> can get useful log from the screen.
>
> How can I do to make x.py ‘s  output un-buffered when redirection log to
> files ,just exactly same with print to the screen?

Use the -u flag to python:
−u    Force stdin, stdout and stderr to be totally unbuffered.

python -u x.py > 1.log 2>&1

Cheers,
Chris
-- 
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to