Also catch RuntimeError when importing pyplot in pid_response.py. v0.3
authorW. Trevor King <wking@drexel.edu>
Wed, 27 Jul 2011 16:08:43 +0000 (12:08 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 27 Jul 2011 16:08:49 +0000 (12:08 -0400)
In case matplotlib is installed, but poorly configured for your
current situation.  For example, if you've SSHed into a host without
tunneling X, you can see:

  $ python -c 'import matplotlib.pyplot'
  /usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py:57:
    GtkWarning: could not open display
  ...
  RuntimeError: could not create GdkCursor object

examples/pid_repsonse.py

index 33311cb0a7d821104e60f8dd6c589a3973531180..f2216b684609e4d8169629d29e3fb0dba590bc40 100755 (executable)
@@ -25,7 +25,7 @@ from time import sleep
 try:
     from matplotlib import pyplot
     from numpy import loadtxt
-except ImportError, e:
+except (ImportError,RuntimeError), e:
     pyplot = None
     loadtxt = None
     plot_import_error = e