Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f901de

Browse files
authored
Merge pull request #11663 from ndtallant/ipython#11535
Verbose error message when displaying a nonexistent image.
2 parents 4d60611 + c841e6d commit 4f901de

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

IPython/core/display.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,11 @@ def _repr_mimebundle_(self, include=None, exclude=None):
12501250

12511251
def _data_and_metadata(self, always_both=False):
12521252
"""shortcut for returning metadata with shape information, if defined"""
1253-
b64_data = b2a_base64(self.data).decode('ascii')
1253+
try:
1254+
b64_data = b2a_base64(self.data).decode('ascii')
1255+
except TypeError:
1256+
raise FileNotFoundError(
1257+
"No such file or directory: '%s'" % (self.data))
12541258
md = {}
12551259
if self.metadata:
12561260
md.update(self.metadata)

0 commit comments

Comments
 (0)