Show a more descriptive error on missing Tkinter
If the demos are run outside of spyder or jupyter, or on a machine
without the `python-tk` package (on Debian-based distrbutions; its name
may vary on other Linux distributions), we want to show a user-friendly
error.
@@ -9,7 +9,16 @@ import functools
import re # Regular expression, for string cleaning
import warnings
import numpy as np # Python's numeric library, abbreviated "np"
+try:
import pylab as plt # Python's plotting library
+except ImportError:
+ import sys
+ exception_type, value, traceback = sys.exc_info()
+ raise ImportError, (
+ 'HARK must be used in a graphical environment.',
+ exception_type,
+ value
+ ), traceback
import scipy.stats as stats # Python's statistics library
from scipy.interpolate import interp1d
from scipy.special import erf, erfc
