From: W. Trevor King Date: Wed, 27 Jul 2011 16:08:43 +0000 (-0400) Subject: Also catch RuntimeError when importing pyplot in pid_response.py. X-Git-Tag: v0.3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cd85f6b04e647f0b77b96817610aff242630e4b5;p=pypid.git Also catch RuntimeError when importing pyplot in pid_response.py. 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 --- diff --git a/examples/pid_repsonse.py b/examples/pid_repsonse.py index 33311cb..f2216b6 100755 --- a/examples/pid_repsonse.py +++ b/examples/pid_repsonse.py @@ -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