File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 5252is your friend to debug the format of the content message.
5353"""
5454import base64
55- import imghdr
5655import json
5756import os
5857import re
5958
59+ import filetype
60+
6061
6162_TEXT_SAVED_IMAGE = "bash_kernel: saved image data to: "
6263_TEXT_SAVED_HTML = "bash_kernel: saved html data to: "
@@ -101,8 +102,7 @@ def display_data_for_image(filename):
101102 with open (filename , 'rb' ) as f :
102103 image = f .read ()
103104 _unlink_if_temporary (filename )
104-
105- image_type = imghdr .what (None , image )
105+ image_type = filetype .image_match (image ).extension
106106 if image_type is None :
107107 raise ValueError ("Not a valid image: %s" % image )
108108
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ authors = [
88 {name = " Thomas Kluyver" , email = " thomas@kluyver.me.uk" },
99]
1010readme = " README.rst"
11- dependencies = [" pexpect (>=4.0)" , " ipykernel" ]
11+ dependencies = [" pexpect (>=4.0)" , " ipykernel" , " filetype " ]
1212classifiers = [
1313 " Framework :: Jupyter" ,
1414 " License :: OSI Approved :: BSD License" ,
You can’t perform that action at this time.
0 commit comments