From 6eb3859e46d925c04995b96a40f20b94325d62cb 2017-02-24 16:21:00 From: meeseeksdev[bot] Date: 2017-02-24 16:21:00 Subject: [PATCH] Merge pull request #10317 from gnestor/json-warn Suppress "not JSON strings" warning if `filename` argument is provided --- diff --git a/IPython/core/display.py b/IPython/core/display.py index 4d43552..9807e63 100644 --- a/IPython/core/display.py +++ b/IPython/core/display.py @@ -655,7 +655,8 @@ class JSON(DisplayObject): @data.setter def data(self, data): if isinstance(data, str): - warnings.warn("JSON expects JSONable dict or list, not JSON strings") + if getattr(self, 'filename', None) is None: + warnings.warn("JSON expects JSONable dict or list, not JSON strings") data = json.loads(data) self._data = data @@ -757,6 +758,8 @@ class GeoJSON(DisplayObject): @data.setter def data(self, data): if isinstance(data, str): + if getattr(self, 'filename', None) is None: + warnings.warn("GeoJSON expects JSONable dict or list, not JSON strings") data = json.loads(data) self._data = data