From a03fb2ef23cd5d27f590f412b94d119041c562a7 Mon Sep 17 00:00:00 2001 From: mikael frosini Date: Mon, 30 Nov 2020 15:26:38 +0100 Subject: [PATCH] Checking type of image first --- ipyplot/_html_helpers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ipyplot/_html_helpers.py b/ipyplot/_html_helpers.py index 569a2a3..1baa16d 100644 --- a/ipyplot/_html_helpers.py +++ b/ipyplot/_html_helpers.py @@ -274,7 +274,7 @@ def _create_img( img_html += '

%s

' % str(custom_text) # NOQA E501 use_b64 = True - inline_svg = (inline_svg and image[-4:]==".svg") + inline_svg = (inline_svg and isinstance(img,str) and image[-4:]==".svg") if inline_svg: use_b64 = False # if image is a string (URL) display its URL @@ -293,8 +293,8 @@ def _create_img( img_html += '' % _img_to_base64(image, width) # NOQA E501 if inline_svg: - string = urllib.parse.quote(open(image,'r').read()) - img_html += f'' + svg_url = urllib.parse.quote(open(image,'r').read()) + img_html += f'' html = """