From dab5e22dd74b92870b2416641e71cda18a336945 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Fri, 15 Nov 2024 14:21:39 +0100 Subject: [PATCH] Replaced deprecated/removed imghdr with puremagic package It was deprecated in Python 3.11 and removed in Python 3.13 https://peps.python.org/pep-0594/#deprecated-modules --- mayavi/__init__.py | 3 ++- mayavi/tools/remote/remote_widget.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mayavi/__init__.py b/mayavi/__init__.py index 27c028128..08502380b 100644 --- a/mayavi/__init__.py +++ b/mayavi/__init__.py @@ -18,7 +18,8 @@ 'traitsui>=7.0.0', 'packaging', 'importlib_resources; python_version<"3.11"', - 'vtk' + 'vtk', + 'puremagic' ] __extras_require__ = { diff --git a/mayavi/tools/remote/remote_widget.py b/mayavi/tools/remote/remote_widget.py index ea6498324..213928919 100644 --- a/mayavi/tools/remote/remote_widget.py +++ b/mayavi/tools/remote/remote_widget.py @@ -1,4 +1,4 @@ -import imghdr +import puremagic class RemoteWidget(object): @@ -50,7 +50,7 @@ def show_image(self, data, format='PNG'): def _update_image(self): data = self.scene_proxy.get_raw_image() - format = imghdr.what('', h=data) + format = puremagic.what('', h=data) self.show_image(data, format=format.upper()) # ##### VTK Event handling ##########