Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 combining stdout and stderr
#1
i want to combine stdout and stderr on the same output so both can go over a single pipe. the buffering of stdout can mess up the line ordering. i don't want to solve that be eliminating buffering. i want output to either to be buffered in a common buffer. it seemed to work when i did
    import sys
    ...
    sys.stdout.flush() # not necessary if before any output
    sys.stderr.flush() # i have hit cases where it was buffered
    sys.stderr = sys.stdout
    ...
is there a more appropriate way to do this?
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote
#2
Skaperen Wrote:is there a more appropriate way to do this?
I don't see one. The code looks very pythonic.
Quote

Top Page

Forum Jump:


Users browsing this thread: 1 Guest(s)