diff --git a/python/plugins/processing/algs/gdal/AssignProjection.py b/python/plugins/processing/algs/gdal/AssignProjection.py index 64859d1a7822..f8722a9e7075 100644 --- a/python/plugins/processing/algs/gdal/AssignProjection.py +++ b/python/plugins/processing/algs/gdal/AssignProjection.py @@ -92,9 +92,13 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): arguments.append(fileName) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) self.setOutputValue(self.OUTPUT, fileName) + return commands diff --git a/python/plugins/processing/algs/gdal/fillnodata.py b/python/plugins/processing/algs/gdal/fillnodata.py index b5cf2c1399cb..76c7b3831823 100644 --- a/python/plugins/processing/algs/gdal/fillnodata.py +++ b/python/plugins/processing/algs/gdal/fillnodata.py @@ -130,8 +130,11 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): arguments.append(raster.source()) arguments.append(out) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/gdal2tiles.py b/python/plugins/processing/algs/gdal/gdal2tiles.py index 935dad13fa43..26c10c8e9775 100644 --- a/python/plugins/processing/algs/gdal/gdal2tiles.py +++ b/python/plugins/processing/algs/gdal/gdal2tiles.py @@ -229,8 +229,11 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): arguments.append(inLayer.source()) arguments.append(self.parameterAsString(parameters, self.OUTPUT, context)) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/gdal2xyz.py b/python/plugins/processing/algs/gdal/gdal2xyz.py index 03372f35dda9..c12c69e19562 100644 --- a/python/plugins/processing/algs/gdal/gdal2xyz.py +++ b/python/plugins/processing/algs/gdal/gdal2xyz.py @@ -94,8 +94,11 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): arguments.append(raster.source()) arguments.append(self.parameterAsFileOutput(parameters, self.OUTPUT, context)) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/merge.py b/python/plugins/processing/algs/gdal/merge.py index 6960949d2875..c3871aaa9827 100644 --- a/python/plugins/processing/algs/gdal/merge.py +++ b/python/plugins/processing/algs/gdal/merge.py @@ -166,8 +166,11 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): arguments.append('--optfile') arguments.append(list_file) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/pct2rgb.py b/python/plugins/processing/algs/gdal/pct2rgb.py index 4556c783bfbb..7c7b165df769 100644 --- a/python/plugins/processing/algs/gdal/pct2rgb.py +++ b/python/plugins/processing/algs/gdal/pct2rgb.py @@ -103,8 +103,11 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): if self.parameterAsBool(parameters, self.RGBA, context): arguments.append('-rgba') - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/polygonize.py b/python/plugins/processing/algs/gdal/polygonize.py index 930406778563..ff519bd4bc68 100644 --- a/python/plugins/processing/algs/gdal/polygonize.py +++ b/python/plugins/processing/algs/gdal/polygonize.py @@ -116,8 +116,11 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): arguments.append(layerName) arguments.append(self.parameterAsString(parameters, self.FIELD, context)) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/proximity.py b/python/plugins/processing/algs/gdal/proximity.py index 8138fcd5986d..d5a0f7be1149 100644 --- a/python/plugins/processing/algs/gdal/proximity.py +++ b/python/plugins/processing/algs/gdal/proximity.py @@ -187,8 +187,11 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): arguments.append(inLayer.source()) arguments.append(out) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/retile.py b/python/plugins/processing/algs/gdal/retile.py index 7e4f6154569b..d38a0a2218a0 100644 --- a/python/plugins/processing/algs/gdal/retile.py +++ b/python/plugins/processing/algs/gdal/retile.py @@ -209,8 +209,11 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): layers = [l.source() for l in self.parameterAsLayerList(parameters, self.INPUT, context)] arguments.extend(layers) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/rgb2pct.py b/python/plugins/processing/algs/gdal/rgb2pct.py index 118aff5cbfdd..36c83963615b 100644 --- a/python/plugins/processing/algs/gdal/rgb2pct.py +++ b/python/plugins/processing/algs/gdal/rgb2pct.py @@ -95,8 +95,11 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): arguments.append(raster.source()) arguments.append(out) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands diff --git a/python/plugins/processing/algs/gdal/sieve.py b/python/plugins/processing/algs/gdal/sieve.py index 6d8ae59b1b2e..a7a80ef7e440 100644 --- a/python/plugins/processing/algs/gdal/sieve.py +++ b/python/plugins/processing/algs/gdal/sieve.py @@ -120,8 +120,11 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True): arguments.append(raster.source()) arguments.append(out) - commands = [self.commandName() + '.py', GdalUtils.escapeAndJoin(arguments)] if isWindows(): - commands.insert(0, 'python3') + commands = ["python3", "-m", self.commandName()] + else: + commands = [self.commandName() + '.py'] + + commands.append(GdalUtils.escapeAndJoin(arguments)) return commands