diff --git a/IPython/core/display.py b/IPython/core/display.py index bbbacff..a65155f 100644 --- a/IPython/core/display.py +++ b/IPython/core/display.py @@ -655,7 +655,7 @@ class JSON(DisplayObject): @data.setter def data(self, data): if isinstance(data, str): - if getattr(self, 'filename') is None: + 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 @@ -690,7 +690,7 @@ class GeoJSON(JSON): @data.setter def data(self, data): if isinstance(data, str): - if getattr(self, 'filename') is None: + 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