Python Forum
combining stdout and stderr
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?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
combining stdout and stderr - by Skaperen - Nov-01-2019, 01:34 AM
RE: combining stdout and stderr - by Gribouillis - Nov-01-2019, 07:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  setting STDOUT and/or STDERR Skaperen 7 999 Dec-08-2023, 08:38 AM
Last Post: Gribouillis
  capture stdout from child processes Skaperen 0 3,309 Oct-30-2019, 12:11 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020