diff --git a/preditor/stream/director.py b/preditor/stream/director.py index ded2338f..87206703 100644 --- a/preditor/stream/director.py +++ b/preditor/stream/director.py @@ -32,9 +32,11 @@ def __init__(self, manager, state, old_stream=None, *args, **kwargs): old_stream = None elif old_stream is None: if state == STDOUT: - old_stream = sys.stdout + if getattr(sys.stdout, 'name', '') != 'nul': + old_stream = sys.stdout elif state == STDERR: - old_stream = sys.stderr + if getattr(sys.stderr, 'name', '') != 'nul': + old_stream = sys.stderr self.old_stream = old_stream def close(self):