Bug report #20632

Grass7 v.dissolve algorithm not working on Windows (WinError 87)

Added by Juan Manuel Perez almost 6 years ago. Updated almost 6 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Processing/GRASS
Affected QGIS version:3.4.1 Regression?:Yes
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28452

Description

GRASS v.dissolve algorithm from the Processing Toolbox doesn't seem to work in Windows systems.
It always ends with a "WinError 87" message.

Processing algorithm…
Algorithm 'v.dissolve' starting…
Input parameters:
{ 'GRASS_MIN_AREA_PARAMETER' : 0.0001, 'GRASS_OUTPUT_TYPE_PARAMETER' : 0, 'GRASS_REGION_PARAMETER' : '931552.2699986211,931578.6464162593,4594204.021120116,4594222.847410772 [EPSG:25830]', 'GRASS_SNAP_TOLERANCE_PARAMETER' : -1, 'GRASS_VECTOR_DSCO' : '', 'GRASS_VECTOR_LCO' : '', 'column' : 'dummy', 'input' : 'D:\\Temp\\bug_WinError87_qgis3master_windows_grass7_dissolve.shp', 'output' : 'D:/users/jmperez/temp/processing_09e5daff338d4f9a94da2bed783de249/75ccebd142da49bfa50071a54f05143f/output.shp' }

g.region n=4594222.847410772 s=4594204.021120116 e=931578.6464162593 w=931552.2699986211
v.dissolve input=vector_5bfbd3302f9b07 column=dummy output=output59e5c6cbc13049c9ac24b6b4289968d8 --overwrite
v.out.ogr -c type="auto" input="output59e5c6cbc13049c9ac24b6b4289968d8" output="D:\users\jmperez\temp\processing_09e5daff338d4f9a94da2bed783de249\75ccebd142da49bfa50071a54f05143f\output.shp" format="ESRI_Shapefile" --overwrite
Cleaning up temporary files...
Starting GRASS GIS...
WARNING: Concurrent mapset locking is not supported on Windows
Executing <D:\users\jmperez\temp\processing_09e5daff338d4f9a94da2bed783de249\grassdata\grass_batch_job.cmd> ...
C:\PROGRA~1\QGIS 3.4\bin>chcp 1252 1>NUL
C:\PROGRA~1\QGIS 3.4\bin>g.region n=4594222.847410772 s=4594204.021120116 e=931578.6464162593 w=931552.2699986211
C:\PROGRA~1\QGIS 3.4\bin>v.dissolve input=vector_5bfbd3302f9b07 column=dummy output=output59e5c6cbc13049c9ac24b6b4289968d8 --overwrite
Execution of <D:\users\jmperez\temp\processing_09e5daff338d4f9a94da2bed783de249\grassdata\grass_batch_job.cmd> finished.
Cleaning up temporary files...
Traceback (most recent call last):
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python/plugins\processing\algs\grass7\Grass7Algorithm.py", line 415, in processAlgorithm
Grass7Utils.executeGrass(self.commands, feedback, self.outputCommands)
File "C:/PROGRA~1/QGIS3~1.4/apps/qgis/./python/plugins\processing\algs\grass7\Grass7Utils.py", line 408, in executeGrass
startupinfo=si if isWindows() else None
File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\subprocess.py", line 756, in __init__
restore_signals, start_new_session)
File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\subprocess.py", line 1155, in _execute_child
startupinfo)
OSError: [WinError 87] El parámetro no es correcto

Execution failed after 1.40 seconds

Loading resulting layers
The following layers were not correctly generated.<ul><li>D:/users/jmperez/temp/processing_09e5daff338d4f9a94da2bed783de249/75ccebd142da49bfa50071a54f05143f/output.shp</li></ul>You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.

I've attached a sample zipped shapefile used for this test.

bug_WinError87_qgis3master_windows_grass7_dissolve.zip (2.33 KB) Juan Manuel Perez, 2018-11-26 01:58 PM

Associated revisions

Revision 42e30b65
Added by Luigi Pirelli almost 6 years ago

Merge pull request #8557 from juanmpd/patch-1

Update Grass7Utils.py. Fixes #20632 #20502

History

#1 Updated by Juan Manuel Perez almost 6 years ago

It may be related to #20502

#2 Updated by Juan Manuel Perez almost 6 years ago

Tested in both 3.4.1 and 3.5.0 Nightly. In both of them it fails.

Note about test with 3.5.0 Nightly: I installed it using "osgeo4w-setup-x86_64", selecting qgis-dev (3.5.0-23) and grass-daily (7.7.svn-r73707-326). Doing this result in grass algorithms not running at all (Qgis tries to parse "svn" as an integer,...). I patched it renaming the folder grass-7.7.svn to grass-7.7.0, making a copy of grass77svn.bat into grass.bat, modifying it to replace the reference to grass-7.7.svn folder to grass-7.7.0 folder, and editing env.bat within grass-7-7.0/etc folder to also point to grass-7.7.0 folder instead of grass-7.7.svn one.

#3 Updated by Giovanni Manghi almost 6 years ago

  • Priority changed from Normal to High
  • Category changed from GRASS to Processing/GRASS

#4 Updated by Juan Manuel Perez almost 6 years ago

Just found a change in Grass7Utils.py that seems to solve this problem.
I just created a pull request in github... Sorry if I did't it correctly, it is the first time I use it. I don't know how to link here to the pull request. But here is the patch for request:

From 9b61eb8b71876fa36cbae6d9c0be78cac22824bc Mon Sep 17 00:00:00 2001
From: juanmpd <[email protected]>
Date: Tue, 27 Nov 2018 10:17:02 +0100
Subject: [PATCH] Update Grass7Utils.py

Related to https://issues.qgis.org/issues/20632
This seems to solve this issue, but I don't really know if this change may be introducing some collateral effect.
It should be revised by someone with good knowledge of this piece of code.
---
 python/plugins/processing/algs/grass7/Grass7Utils.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/python/plugins/processing/algs/grass7/Grass7Utils.py b/python/plugins/processing/algs/grass7/Grass7Utils.py
index a3ffdd919d4..f89fdac2ada 100644
--- a/python/plugins/processing/algs/grass7/Grass7Utils.py
+++ b/python/plugins/processing/algs/grass7/Grass7Utils.py
@@ -400,6 +400,11 @@ def executeGrass(commands, feedback, outputCommands=None):
         # commands again.
         if not grassOutDone and outputCommands:
             command, grassenv = Grass7Utils.prepareGrassExecution(outputCommands)
+            # For MS-Windows, we need to hide the console window.
+            if isWindows():
+                si = subprocess.STARTUPINFO()
+                si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+                si.wShowWindow = subprocess.SW_HIDE
             with subprocess.Popen(
                     command,
                     shell=False,

#5 Updated by Giovanni Manghi almost 6 years ago

  • Operating System deleted (Windows 7 64 bits)
  • Pull Request or Patch supplied changed from No to Yes

#6 Updated by Giovanni Manghi almost 6 years ago

  • Operating System set to Windows

#7 Updated by Luigi Pirelli almost 6 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF