Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 combining stdout and stderr
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.
Skaperen Wrote:is there a more appropriate way to do this?
I don't see one. The code looks very pythonic.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  capture stdout from child processes Skaperen 0 1,199 Oct-30-2019, 12:11 AM
Last Post: Skaperen

Forum Jump:

Users browsing this thread: 1 Guest(s)