redirecting stderr back..
Дамјан Георгиевски
gdamjan at gmail.com
Mon Jan 12 19:43:34 EST 2009
> Hi All,
>
> Can someone tell me how to redirect stderr back to the console once
> you've moved it?
>
> import os,sys
> se = os.open("/tmp/mod.log", os.O_WRONLY|os.O_APPEND|os.O_CREAT)
> sys.stderr.write("Foobar\n")
> Foobar
> os.dup2(se, 2)
why not os.dup2(2, 10) and then later os.dup2(10, 2)
--
дамјан ( http://softver.org.mk/damjan/ )
Begin...the rest is easy.
More information about the Python-list
mailing list