Show More
@@ -1250,7 +1250,11 b' class Image(DisplayObject):' | |||||
1250 |
|
1250 | |||
1251 | def _data_and_metadata(self, always_both=False): |
|
1251 | def _data_and_metadata(self, always_both=False): | |
1252 | """shortcut for returning metadata with shape information, if defined""" |
|
1252 | """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)) | |||
1254 | md = {} |
|
1258 | md = {} | |
1255 | if self.metadata: |
|
1259 | if self.metadata: | |
1256 | md.update(self.metadata) |
|
1260 | md.update(self.metadata) | |
@@ -1266,12 +1270,10 b' class Image(DisplayObject):' | |||||
1266 | return b64_data |
|
1270 | return b64_data | |
1267 |
|
1271 | |||
1268 | def _repr_png_(self): |
|
1272 | def _repr_png_(self): | |
1269 | if self.embed and self.format == self._FMT_PNG: |
|
1273 | return self._data_and_metadata() | |
1270 | return self._data_and_metadata() |
|
|||
1271 |
|
1274 | |||
1272 | def _repr_jpeg_(self): |
|
1275 | def _repr_jpeg_(self): | |
1273 | if self.embed and self.format == self._FMT_JPEG: |
|
1276 | return self._data_and_metadata() | |
1274 | return self._data_and_metadata() |
|
|||
1275 |
|
1277 | |||
1276 | def _find_ext(self, s): |
|
1278 | def _find_ext(self, s): | |
1277 | return s.split('.')[-1].lower() |
|
1279 | return s.split('.')[-1].lower() |
General Comments 0
You need to be logged in to leave comments.
Login now