From 0de28a155595961eea4e01d19fb55c75a7798f19 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 27 May 2024 20:00:55 +0200 Subject: [PATCH] Python utilities: avoid UseExceptions() related deprecation warning when launched from launcher shell scripts Fixes #10010 The launcher shell scripts generated by setuptools don't use our gdal-utils/scripts/{script_name}.py scripts, but directly the gdal-utils/osgeo_utils/{script_name}.py one. Hence let's move the call to UseExceptions() from the former to the later. --- swig/python/gdal-utils/osgeo_utils/gdal2tiles.py | 2 ++ swig/python/gdal-utils/osgeo_utils/gdal2xyz.py | 1 + swig/python/gdal-utils/osgeo_utils/gdal_calc.py | 1 + swig/python/gdal-utils/osgeo_utils/gdal_edit.py | 1 + swig/python/gdal-utils/osgeo_utils/gdal_fillnodata.py | 1 + swig/python/gdal-utils/osgeo_utils/gdal_merge.py | 1 + swig/python/gdal-utils/osgeo_utils/gdal_pansharpen.py | 3 +++ swig/python/gdal-utils/osgeo_utils/gdal_polygonize.py | 1 + swig/python/gdal-utils/osgeo_utils/gdal_proximity.py | 2 ++ swig/python/gdal-utils/osgeo_utils/gdal_retile.py | 3 +++ swig/python/gdal-utils/osgeo_utils/gdal_sieve.py | 2 ++ swig/python/gdal-utils/osgeo_utils/gdalattachpct.py | 3 +++ swig/python/gdal-utils/osgeo_utils/gdalcompare.py | 3 +++ swig/python/gdal-utils/osgeo_utils/gdalmove.py | 4 +++- swig/python/gdal-utils/osgeo_utils/ogr_layer_algebra.py | 2 ++ swig/python/gdal-utils/osgeo_utils/ogrmerge.py | 5 +---- swig/python/gdal-utils/osgeo_utils/pct2rgb.py | 1 + swig/python/gdal-utils/osgeo_utils/rgb2pct.py | 1 + swig/python/gdal-utils/scripts/gdal2tiles.py | 4 +--- swig/python/gdal-utils/scripts/gdal2xyz.py | 4 +--- swig/python/gdal-utils/scripts/gdal_calc.py | 4 +--- swig/python/gdal-utils/scripts/gdal_edit.py | 4 +--- swig/python/gdal-utils/scripts/gdal_fillnodata.py | 4 +--- swig/python/gdal-utils/scripts/gdal_merge.py | 4 +--- swig/python/gdal-utils/scripts/gdal_pansharpen.py | 4 +--- swig/python/gdal-utils/scripts/gdal_polygonize.py | 4 +--- swig/python/gdal-utils/scripts/gdal_proximity.py | 4 +--- swig/python/gdal-utils/scripts/gdal_retile.py | 4 +--- swig/python/gdal-utils/scripts/gdal_sieve.py | 4 +--- swig/python/gdal-utils/scripts/gdalattachpct.py | 4 +--- swig/python/gdal-utils/scripts/gdalcompare.py | 4 +--- swig/python/gdal-utils/scripts/gdalmove.py | 4 +--- swig/python/gdal-utils/scripts/ogr_layer_algebra.py | 4 +--- swig/python/gdal-utils/scripts/ogrmerge.py | 4 +--- swig/python/gdal-utils/scripts/pct2rgb.py | 4 +--- swig/python/gdal-utils/scripts/rgb2pct.py | 4 +--- 36 files changed, 50 insertions(+), 59 deletions(-) diff --git a/swig/python/gdal-utils/osgeo_utils/gdal2tiles.py b/swig/python/gdal-utils/osgeo_utils/gdal2tiles.py index da560c837437..2287834bc246 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal2tiles.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal2tiles.py @@ -59,6 +59,8 @@ Options = Any +gdal.UseExceptions() + try: import numpy from PIL import Image diff --git a/swig/python/gdal-utils/osgeo_utils/gdal2xyz.py b/swig/python/gdal-utils/osgeo_utils/gdal2xyz.py index 5440447d8769..1c77ec25954e 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal2xyz.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal2xyz.py @@ -423,6 +423,7 @@ def doit(self, **kwargs): def main(argv=sys.argv): + gdal.UseExceptions() return GDAL2XYZ().main(argv) diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_calc.py b/swig/python/gdal-utils/osgeo_utils/gdal_calc.py index 777cdfd05975..2b6fea3a0985 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal_calc.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_calc.py @@ -925,6 +925,7 @@ def augment_kwargs(self, kwargs) -> dict: def main(argv=sys.argv): + gdal.UseExceptions() return GDALCalc().main(argv) diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_edit.py b/swig/python/gdal-utils/osgeo_utils/gdal_edit.py index a8864e6a13c4..cfcd459517d2 100755 --- a/swig/python/gdal-utils/osgeo_utils/gdal_edit.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_edit.py @@ -538,6 +538,7 @@ def gdal_edit(argv): def main(argv=sys.argv): + gdal.UseExceptions() return gdal_edit(argv) diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_fillnodata.py b/swig/python/gdal-utils/osgeo_utils/gdal_fillnodata.py index 60960befd199..3a8fc5c4f46b 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal_fillnodata.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_fillnodata.py @@ -285,6 +285,7 @@ def doit(self, **kwargs): def main(argv=sys.argv): + gdal.UseExceptions() return GDALFillNoData().main(argv) diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_merge.py b/swig/python/gdal-utils/osgeo_utils/gdal_merge.py index 72f64ffba9a3..442bf2f9349c 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal_merge.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_merge.py @@ -647,6 +647,7 @@ def gdal_merge(argv=None): def main(argv=sys.argv): + gdal.UseExceptions() return gdal_merge(argv) diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_pansharpen.py b/swig/python/gdal-utils/osgeo_utils/gdal_pansharpen.py index 7c640c294759..02af4295d3be 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal_pansharpen.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_pansharpen.py @@ -69,6 +69,9 @@ def Usage(isError): def main(argv=sys.argv): + + gdal.UseExceptions() + argv = gdal.GeneralCmdLineProcessor(argv) if argv is None: return 0 diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_polygonize.py b/swig/python/gdal-utils/osgeo_utils/gdal_polygonize.py index 9fbd361168b7..b4aaa5656305 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal_polygonize.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_polygonize.py @@ -355,6 +355,7 @@ def doit(self, **kwargs): def main(argv=sys.argv): + gdal.UseExceptions() return GDALPolygonize().main(argv) diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_proximity.py b/swig/python/gdal-utils/osgeo_utils/gdal_proximity.py index ab9059cf23dc..09d7a51a3cc5 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal_proximity.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_proximity.py @@ -65,6 +65,8 @@ def main(argv=sys.argv): creation_type = "Float32" quiet = False + gdal.UseExceptions() + argv = gdal.GeneralCmdLineProcessor(argv) if argv is None: return 0 diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_retile.py b/swig/python/gdal-utils/osgeo_utils/gdal_retile.py index a69946339c46..1e2614a072d3 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal_retile.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_retile.py @@ -942,6 +942,9 @@ def Usage(isError): def main(args=None, g=None): + + gdal.UseExceptions() + if g is None: g = RetileGlobals() diff --git a/swig/python/gdal-utils/osgeo_utils/gdal_sieve.py b/swig/python/gdal-utils/osgeo_utils/gdal_sieve.py index e5d561022528..c014299b5aab 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdal_sieve.py +++ b/swig/python/gdal-utils/osgeo_utils/gdal_sieve.py @@ -60,6 +60,8 @@ def main(argv=sys.argv): mask = "default" + gdal.UseExceptions() + argv = gdal.GeneralCmdLineProcessor(argv) if argv is None: return 0 diff --git a/swig/python/gdal-utils/osgeo_utils/gdalattachpct.py b/swig/python/gdal-utils/osgeo_utils/gdalattachpct.py index 80b88c11014f..6f5dfcc62ed3 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdalattachpct.py +++ b/swig/python/gdal-utils/osgeo_utils/gdalattachpct.py @@ -48,6 +48,9 @@ def Usage(isError=True): def main(argv=sys.argv): + + gdal.UseExceptions() + pct_filename = None src_filename = None dst_filename = None diff --git a/swig/python/gdal-utils/osgeo_utils/gdalcompare.py b/swig/python/gdal-utils/osgeo_utils/gdalcompare.py index 139e72f4d4ff..4d57f09c81f9 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdalcompare.py +++ b/swig/python/gdal-utils/osgeo_utils/gdalcompare.py @@ -503,6 +503,9 @@ def Usage(isError=True): def main(argv=sys.argv): + + gdal.UseExceptions() + # Default GDAL argument parsing. argv = gdal.GeneralCmdLineProcessor(argv) if argv is None: diff --git a/swig/python/gdal-utils/osgeo_utils/gdalmove.py b/swig/python/gdal-utils/osgeo_utils/gdalmove.py index 6a986641bb43..f198ac5c5964 100644 --- a/swig/python/gdal-utils/osgeo_utils/gdalmove.py +++ b/swig/python/gdal-utils/osgeo_utils/gdalmove.py @@ -245,8 +245,10 @@ def Usage(isError=True): def main(argv=sys.argv): - # Default GDAL argument parsing. + gdal.UseExceptions() + + # Default GDAL argument parsing. argv = gdal.GeneralCmdLineProcessor(argv) if argv is None: return 0 diff --git a/swig/python/gdal-utils/osgeo_utils/ogr_layer_algebra.py b/swig/python/gdal-utils/osgeo_utils/ogr_layer_algebra.py index e85b9a3016aa..3069eb72327d 100644 --- a/swig/python/gdal-utils/osgeo_utils/ogr_layer_algebra.py +++ b/swig/python/gdal-utils/osgeo_utils/ogr_layer_algebra.py @@ -191,6 +191,8 @@ def main(argv=sys.argv): srs_name = None srs = None + gdal.UseExceptions() + argv = ogr.GeneralCmdLineProcessor(argv) if argv is None: return 0 diff --git a/swig/python/gdal-utils/osgeo_utils/ogrmerge.py b/swig/python/gdal-utils/osgeo_utils/ogrmerge.py index d7b3bfaff7b8..28846dd52b84 100644 --- a/swig/python/gdal-utils/osgeo_utils/ogrmerge.py +++ b/swig/python/gdal-utils/osgeo_utils/ogrmerge.py @@ -518,10 +518,6 @@ def _gpkg_ogrmerge( if dst_ds is None: return 1 - ogr.UseExceptions() - gdal.UseExceptions() - osr.UseExceptions() - class ThreadedProgress: def __init__(self, dst_filename, estimated_final_size): self.stop_thread = False @@ -1207,6 +1203,7 @@ def are_sources_gpkg(): def main(argv=sys.argv): + gdal.UseExceptions() argv = ogr.GeneralCmdLineProcessor(argv) if argv is None: return 0 diff --git a/swig/python/gdal-utils/osgeo_utils/pct2rgb.py b/swig/python/gdal-utils/osgeo_utils/pct2rgb.py index d7fe81538ac1..3275e9e00089 100644 --- a/swig/python/gdal-utils/osgeo_utils/pct2rgb.py +++ b/swig/python/gdal-utils/osgeo_utils/pct2rgb.py @@ -223,6 +223,7 @@ def doit(self, **kwargs): def main(argv=sys.argv): + gdal.UseExceptions() return PCT2RGB().main(argv) diff --git a/swig/python/gdal-utils/osgeo_utils/rgb2pct.py b/swig/python/gdal-utils/osgeo_utils/rgb2pct.py index d79b4f926eb9..4b2316660737 100644 --- a/swig/python/gdal-utils/osgeo_utils/rgb2pct.py +++ b/swig/python/gdal-utils/osgeo_utils/rgb2pct.py @@ -202,6 +202,7 @@ def doit(self, **kwargs): def main(argv=sys.argv): + gdal.UseExceptions() return RGB2PCT().main(argv) diff --git a/swig/python/gdal-utils/scripts/gdal2tiles.py b/swig/python/gdal-utils/scripts/gdal2tiles.py index d687f8a0c7b0..b41e6898d7a6 100755 --- a/swig/python/gdal-utils/scripts/gdal2tiles.py +++ b/swig/python/gdal-utils/scripts/gdal2tiles.py @@ -5,9 +5,7 @@ # Running main() must be protected that way due to use of multiprocessing on Windows: # https://docs.python.org/3/library/multiprocessing.html#the-spawn-and-forkserver-start-methods if __name__ == "__main__": - from osgeo.gdal import UseExceptions, deprecation_warn - - UseExceptions() + from osgeo.gdal import deprecation_warn # import osgeo_utils.gdal2tiles as a convenience to use as a script from osgeo_utils.gdal2tiles import * # noqa diff --git a/swig/python/gdal-utils/scripts/gdal2xyz.py b/swig/python/gdal-utils/scripts/gdal2xyz.py index b2681f9ce811..e5f940dc4695 100755 --- a/swig/python/gdal-utils/scripts/gdal2xyz.py +++ b/swig/python/gdal-utils/scripts/gdal2xyz.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdal2xyz as a convenience to use as a script from osgeo_utils.gdal2xyz import * # noqa from osgeo_utils.gdal2xyz import main -UseExceptions() - deprecation_warn("gdal2xyz") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdal_calc.py b/swig/python/gdal-utils/scripts/gdal_calc.py index 008e8437c64d..4fc0bae32340 100755 --- a/swig/python/gdal-utils/scripts/gdal_calc.py +++ b/swig/python/gdal-utils/scripts/gdal_calc.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdal_calc as a convenience to use as a script from osgeo_utils.gdal_calc import * # noqa from osgeo_utils.gdal_calc import main -UseExceptions() - deprecation_warn("gdal_calc") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdal_edit.py b/swig/python/gdal-utils/scripts/gdal_edit.py index 32e2b9dca8c4..d89a54fe980e 100755 --- a/swig/python/gdal-utils/scripts/gdal_edit.py +++ b/swig/python/gdal-utils/scripts/gdal_edit.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdal_edit as a convenience to use as a script from osgeo_utils.gdal_edit import * # noqa from osgeo_utils.gdal_edit import main -UseExceptions() - deprecation_warn("gdal_edit") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdal_fillnodata.py b/swig/python/gdal-utils/scripts/gdal_fillnodata.py index 885adcbe3e78..d3a74e5580a0 100755 --- a/swig/python/gdal-utils/scripts/gdal_fillnodata.py +++ b/swig/python/gdal-utils/scripts/gdal_fillnodata.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdal_fillnodata as a convenience to use as a script from osgeo_utils.gdal_fillnodata import * # noqa from osgeo_utils.gdal_fillnodata import main -UseExceptions() - deprecation_warn("gdal_fillnodata") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdal_merge.py b/swig/python/gdal-utils/scripts/gdal_merge.py index 48a7dcd7d042..95fc79f50bfa 100755 --- a/swig/python/gdal-utils/scripts/gdal_merge.py +++ b/swig/python/gdal-utils/scripts/gdal_merge.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdal_merge as a convenience to use as a script from osgeo_utils.gdal_merge import * # noqa from osgeo_utils.gdal_merge import main -UseExceptions() - deprecation_warn("gdal_merge") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdal_pansharpen.py b/swig/python/gdal-utils/scripts/gdal_pansharpen.py index 55bef6ff2403..5521968e0630 100755 --- a/swig/python/gdal-utils/scripts/gdal_pansharpen.py +++ b/swig/python/gdal-utils/scripts/gdal_pansharpen.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdal_pansharpen as a convenience to use as a script from osgeo_utils.gdal_pansharpen import * # noqa from osgeo_utils.gdal_pansharpen import main -UseExceptions() - deprecation_warn("gdal_pansharpen") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdal_polygonize.py b/swig/python/gdal-utils/scripts/gdal_polygonize.py index 0bd9935072a8..a104fc9f3ff8 100755 --- a/swig/python/gdal-utils/scripts/gdal_polygonize.py +++ b/swig/python/gdal-utils/scripts/gdal_polygonize.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdal_polygonize as a convenience to use as a script from osgeo_utils.gdal_polygonize import * # noqa from osgeo_utils.gdal_polygonize import main -UseExceptions() - deprecation_warn("gdal_polygonize") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdal_proximity.py b/swig/python/gdal-utils/scripts/gdal_proximity.py index fd26a1c364a9..9ef1e76e9fb4 100755 --- a/swig/python/gdal-utils/scripts/gdal_proximity.py +++ b/swig/python/gdal-utils/scripts/gdal_proximity.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdal_proximity as a convenience to use as a script from osgeo_utils.gdal_proximity import * # noqa from osgeo_utils.gdal_proximity import main -UseExceptions() - deprecation_warn("gdal_proximity") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdal_retile.py b/swig/python/gdal-utils/scripts/gdal_retile.py index dad78b04ecd0..3e100ddb85d7 100755 --- a/swig/python/gdal-utils/scripts/gdal_retile.py +++ b/swig/python/gdal-utils/scripts/gdal_retile.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdal_retile as a convenience to use as a script from osgeo_utils.gdal_retile import * # noqa from osgeo_utils.gdal_retile import main -UseExceptions() - deprecation_warn("gdal_retile") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdal_sieve.py b/swig/python/gdal-utils/scripts/gdal_sieve.py index 429214128018..bb44c66852d9 100755 --- a/swig/python/gdal-utils/scripts/gdal_sieve.py +++ b/swig/python/gdal-utils/scripts/gdal_sieve.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdal_sieve as a convenience to use as a script from osgeo_utils.gdal_sieve import * # noqa from osgeo_utils.gdal_sieve import main -UseExceptions() - deprecation_warn("gdal_sieve") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdalattachpct.py b/swig/python/gdal-utils/scripts/gdalattachpct.py index a49d48a6bce9..500ec90ae227 100755 --- a/swig/python/gdal-utils/scripts/gdalattachpct.py +++ b/swig/python/gdal-utils/scripts/gdalattachpct.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdalattachpct as a convenience to use as a script from osgeo_utils.gdalattachpct import * # noqa from osgeo_utils.gdalattachpct import main -UseExceptions() - deprecation_warn("gdalattachpct") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdalcompare.py b/swig/python/gdal-utils/scripts/gdalcompare.py index 954a22b6bbda..1b66df514267 100755 --- a/swig/python/gdal-utils/scripts/gdalcompare.py +++ b/swig/python/gdal-utils/scripts/gdalcompare.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdalcompare as a convenience to use as a script from osgeo_utils.gdalcompare import * # noqa from osgeo_utils.gdalcompare import main -UseExceptions() - deprecation_warn("gdalcompare") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/gdalmove.py b/swig/python/gdal-utils/scripts/gdalmove.py index d3b186a87c6a..0284a20a6d4a 100755 --- a/swig/python/gdal-utils/scripts/gdalmove.py +++ b/swig/python/gdal-utils/scripts/gdalmove.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.gdalmove as a convenience to use as a script from osgeo_utils.gdalmove import * # noqa from osgeo_utils.gdalmove import main -UseExceptions() - deprecation_warn("gdalmove") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/ogr_layer_algebra.py b/swig/python/gdal-utils/scripts/ogr_layer_algebra.py index 909f2ba0e9dd..6acde54ef4b2 100755 --- a/swig/python/gdal-utils/scripts/ogr_layer_algebra.py +++ b/swig/python/gdal-utils/scripts/ogr_layer_algebra.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.ogr_layer_algebra as a convenience to use as a script from osgeo_utils.ogr_layer_algebra import * # noqa from osgeo_utils.ogr_layer_algebra import main -UseExceptions() - deprecation_warn("ogr_layer_algebra") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/ogrmerge.py b/swig/python/gdal-utils/scripts/ogrmerge.py index 992e3e81cbbc..6a736e99f9fa 100755 --- a/swig/python/gdal-utils/scripts/ogrmerge.py +++ b/swig/python/gdal-utils/scripts/ogrmerge.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.ogrmerge as a convenience to use as a script from osgeo_utils.ogrmerge import * # noqa from osgeo_utils.ogrmerge import main -UseExceptions() - deprecation_warn("ogrmerge") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/pct2rgb.py b/swig/python/gdal-utils/scripts/pct2rgb.py index 1d6dbeb7a9e0..3a0932363226 100755 --- a/swig/python/gdal-utils/scripts/pct2rgb.py +++ b/swig/python/gdal-utils/scripts/pct2rgb.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.pct2rgb as a convenience to use as a script from osgeo_utils.pct2rgb import * # noqa from osgeo_utils.pct2rgb import main -UseExceptions() - deprecation_warn("pct2rgb") sys.exit(main(sys.argv)) diff --git a/swig/python/gdal-utils/scripts/rgb2pct.py b/swig/python/gdal-utils/scripts/rgb2pct.py index b8cebcc35ec0..eca0248c82e9 100755 --- a/swig/python/gdal-utils/scripts/rgb2pct.py +++ b/swig/python/gdal-utils/scripts/rgb2pct.py @@ -2,13 +2,11 @@ import sys -from osgeo.gdal import UseExceptions, deprecation_warn +from osgeo.gdal import deprecation_warn # import osgeo_utils.rgb2pct as a convenience to use as a script from osgeo_utils.rgb2pct import * # noqa from osgeo_utils.rgb2pct import main -UseExceptions() - deprecation_warn("rgb2pct") sys.exit(main(sys.argv))