Here are the examples of the python api sys.stdout.stream taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
3
Example 1
def set_trace(*args, **kwargs):
"""Call pdb.set_trace, making sure it receives the unwrapped stdout.
This is so we don't keep drawing progress bars over debugger output.
"""
# There's no stream attr if capture plugin is enabled:
out = sys.stdout.stream if hasattr(sys.stdout, 'stream') else None
# Python 2.5 can't put an explicit kwarg and **kwargs in the same function
# call.
kwargs['stdout'] = out
debugger = pdb.Pdb(*args, **kwargs)
# Ordinarily (and in a silly fashion), pdb refuses to use raw_input() if
# you pass it a stream on instantiation. Fix that:
debugger.use_rawinput = True
debugger.set_trace(sys._getframe().f_back)