[IPython-User] Manually Recreating sys.stderr

Ilia Chinkarev ilia.chinkarev@gmail....
Wed Feb 5 09:24:32 CST 2014


Dear all,

(some third-party module, Yelp's mrjob,  is messing up with the sys.stderr
every time I run it, so I want to give that module new sys.stderr every
time I run it)

What if I do something like:

import sys

my_session = sys.stderr.session
my_pub_socket = sys.stderr.pub_socket
my_name = sys.stderr.name

import IPython.kernel.zmq.iostream as myStream

myStdErr = myStream.OutStream(session = my_session, pub_socket =
my_pub_socket, name = my_name)

sys.stderr = myStdErr


The question is:

What will happen with the stderr that I am replacing? Will it potentially
create memory leaks? Do I have to .close() it?

Thank you all.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20140205/bcafefab/attachment.html 


More information about the IPython-User mailing list