def pylab_not_importable():
try:<EOL><INDENT>import pylab<EOL>return False<EOL><DEDENT>except RuntimeError:<EOL><INDENT>return True<EOL><DEDENT>
Test if importing pylab fails with RuntimeError (true when having no display)