Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #59228

using print() with multiprocessing and pythonw

Newsgroups comp.lang.python
Date 2013-11-12 11:12 -0800
Message-ID <f9d2f31f-e244-42c2-848c-59acf50b6e10@googlegroups.com> (permalink)
Subject using print() with multiprocessing and pythonw
From Isaac Gerg <isaac.gerg@gergltd.com>

Show all headers | View raw


I launch my program with pythonw and begin it with the code below so that all my print()'s go to the log file specified. 

if sys.executable.find('pythonw') >=0:
        # Redirect all console output to file.
        sys.stdout = open("pythonw - stdout stderr.log",'w')
        sys.stderr = sys.stdout

During the course of my program, I call multiprocessing.Process() and launch a function several times.  That function has print()'s inside (which are from warnings being printed by python).  This printing causes the multiprocess to crash.  How can I fix my code so that the print()'s are supressed. I would hate to do a warnings.filterwarnings('ignore') because when I unit test those functions, the warnings dont appear.

Thanks in advance,
Isaac

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

using print() with multiprocessing and pythonw Isaac Gerg <isaac.gerg@gergltd.com> - 2013-11-12 11:12 -0800
  Re: using print() with multiprocessing and pythonw William Ray Wing <wrw@mac.com> - 2013-11-12 15:19 -0500
    Re: using print() with multiprocessing and pythonw Isaac Gerg <isaac.gerg@gergltd.com> - 2013-11-12 12:22 -0800
      Re: using print() with multiprocessing and pythonw Chris Angelico <rosuav@gmail.com> - 2013-11-13 10:09 +1100

csiph-web