From 0f57f2bb386877d2416e3018133d6c67e0f300dc Mon Sep 17 00:00:00 2001 From: Paulo van Breugel Date: Fri, 15 Nov 2024 20:44:30 +0100 Subject: [PATCH] r_out_legend (#1242) Replace the imp module with importlib.util --- src/raster/r.out.legend/r.out.legend.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/raster/r.out.legend/r.out.legend.py b/src/raster/r.out.legend/r.out.legend.py index 5a96efad52..8327082898 100755 --- a/src/raster/r.out.legend/r.out.legend.py +++ b/src/raster/r.out.legend/r.out.legend.py @@ -8,7 +8,7 @@ # DESCRIPTION: Export the legend of a raster as image, which can be used # in e.g., the map composer in QGIS. # -# COPYRIGHT: (C) 2014-2017 by Paulo van Breugel and the GRASS Development Team +# COPYRIGHT: (C) 2014-2024 by Paulo van Breugel and the GRASS Development Team # # This program is free software under the GNU General Public # License (>=v2). Read the file COPYING that comes with GRASS @@ -182,13 +182,13 @@ import grass.script as grass from grass.pygrass.modules import Module from grass.script.utils import parse_key_val -import imp +import importlib.util -try: - imp.find_module("PIL") +spec = importlib.util.find_spec("PIL") +if spec is not None: found = True from PIL import Image -except ImportError: +else: found = False