Skip to content

Instantly share code, notes, and snippets.

@iMichka
Created February 21, 2014 09:33
Show Gist options
  • Save iMichka/9131352 to your computer and use it in GitHub Desktop.
Save iMichka/9131352 to your computer and use it in GitHub Desktop.
Hide ITK wrapping warnings
class FetchStderr(object):
def write(self, err):
display = False
if display:
# Display the warnings
sys.stdout.write(err)
else:
# Do not display the warnings
pass
import sys
original_stderr = sys.stderr # Keep a reference to STDERR
sys.stderr = FetchStderr() # Redirect the real STDERR
import itk
# Load an empty image
an_image = itk.Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment