--- /home/mark/opt/python33/lib/python3.3/multiprocessing/forking.py 2013-08-21 09:18:42.494524037 +0100 +++ forking.py 2014-02-12 12:55:49.867496406 +0000 @@ -87,8 +87,10 @@ class Popen(object): def __init__(self, process_obj): - sys.stdout.flush() - sys.stderr.flush() + if sys.stdout is not None: + sys.stdout.flush() + if sys.stderr is not None: + sys.stderr.flush() self.returncode = None --- /home/mark/opt/python33/lib/python3.3/multiprocessing/managers.py 2013-08-21 09:18:42.498524038 +0100 +++ managers.py 2014-02-12 12:55:53.543280491 +0000 @@ -157,7 +157,7 @@ except (KeyboardInterrupt, SystemExit): pass finally: - if sys.stdout != sys.__stdout__: + if sys.stdout is None or sys.stdout != sys.__stdout__: util.debug('resetting stdout, stderr') sys.stdout = sys.__stdout__ sys.stderr = sys.__stderr__ --- /home/mark/opt/python33/lib/python3.3/multiprocessing/process.py 2013-08-21 09:18:42.506524038 +0100 +++ process.py 2014-02-12 12:55:57.667038272 +0000 @@ -265,17 +265,21 @@ elif isinstance(e.args[0], int): exitcode = e.args[0] else: - sys.stderr.write(str(e.args[0]) + '\n') + if sys.stderr is not None: + sys.stderr.write(str(e.args[0]) + '\n') exitcode = 0 if isinstance(e.args[0], str) else 1 except: exitcode = 1 import traceback - sys.stderr.write('Process %s:\n' % self.name) + if sys.stderr is not None: + sys.stderr.write('Process %s:\n' % self.name) traceback.print_exc() finally: util.info('process exiting with exitcode %d' % exitcode) - sys.stdout.flush() - sys.stderr.flush() + if sys.stdout is not None: + sys.stdout.flush() + if sys.stderr is not None: + sys.stderr.flush() return exitcode