From: W. Trevor King Date: Tue, 15 Jan 2013 16:08:56 +0000 (-0500) Subject: FFT_tools: Catch RuntimeErrors when importing matplotlib X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=FFT-tools.git FFT_tools: Catch RuntimeErrors when importing matplotlib For example, if your default backend is GTKAgg, but you don't have $DISPLAY set, you can get: RuntimeError: could not create GdkCursor object --- diff --git a/FFT_tools.py b/FFT_tools.py index e85e430..e6d058c 100644 --- a/FFT_tools.py +++ b/FFT_tools.py @@ -32,7 +32,7 @@ import unittest as _unittest import numpy as _numpy try: import matplotlib.pyplot as _pyplot -except ImportError as e: +except (ImportError, RuntimeError) as e: _pyplot = None _pyplot_import_error = e