[IPython-dev] How to print stderr in qtconsole?

MinRK benjaminrk@gmail....
Mon Jun 10 20:47:29 CDT 2013


It's probably an issue of unittest hooking up to `sys.__stderr__` instead
of `sys.stderr`. We don't (and shouldn't) redirect the lower-level private
handle, but you can tell it to use `sys.stderr` instead:

import sys
import unittest

class tests(unittest.TestCase):

    def test_raise(self):
        print 1 / 0

if __name__ == '__main__':
    unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stderr))

which should display output just fine in the QtConsole.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20130610/112c3fcf/attachment.html 


More information about the IPython-dev mailing list