From 708961cc59e4bfb36ce3a7e88060f62f1b2358f1 2019-03-14 16:58:13 From: Matan Gover Date: 2019-03-14 16:58:13 Subject: [PATCH] Better error when rate is not specified. --- diff --git a/IPython/lib/display.py b/IPython/lib/display.py index 15fe566..a163b6a 100644 --- a/IPython/lib/display.py +++ b/IPython/lib/display.py @@ -97,6 +97,8 @@ class Audio(DisplayObject): super(Audio, self).__init__(data=data, url=url, filename=filename) if self.data is not None and not isinstance(self.data, bytes): + if rate is None: + raise ValueError("rate must be specified when data is a numpy array or list of audio samples.") self.data = Audio._make_wav(data, rate) def reload(self):