diff --git a/scriptcwl/step.py b/scriptcwl/step.py
index <HASH>..<HASH> 100644
--- a/scriptcwl/step.py
+++ b/scriptcwl/step.py
@@ -13,14 +13,19 @@ from .reference import Reference
 # Helper function to make the import of cwltool.load_tool quiet
 @contextmanager
 def quiet():
+    # save stdout/stderr
+    # Jupyter doesn't support setting it back to
+    # sys.__stdout__ and sys.__stderr__
+    _sys_stdout = sys.stdout
+    _sys_stderr = sys.stderr
     # Divert stdout and stderr to devnull
     sys.stdout = sys.stderr = open(os.devnull, "w")
     try:
         yield
     finally:
         # Revert back to standard stdout/stderr
-        sys.stdout = sys.__stdout__
-        sys.stderr = sys.__stderr__
+        sys.stdout = _sys_stdout
+        sys.stderr = _sys_stderr
 
 
 # import cwltool.load_tool functions
don't set sys.stdout and sys.stderr back to sys.__stdout__ and sys.__stderr__. This doesn't work in Jupyter notebooks, so save previous state to variable instead and setting back to saved state