Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
qgib opened this issue Nov 26, 2018 · 7 comments
Closed

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

qgib opened this issue Nov 26, 2018 · 7 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! GRASS High Priority Regression Something which used to work, but doesn't anymore

Comments

@qgib
Copy link
Contributor

qgib commented Nov 26, 2018

Author Name: Juan Manuel Perez (@juanmpd)
Original Redmine Issue: 20632
Affected QGIS version: 3.4.1
Redmine category:processing/grass


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.


@qgib
Copy link
Contributor Author

qgib commented Nov 26, 2018

Author Name: Juan Manuel Perez (@juanmpd)


It may be related to #28322

@qgib
Copy link
Contributor Author

qgib commented Nov 26, 2018

Author Name: Juan Manuel Perez (@juanmpd)


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.

@qgib
Copy link
Contributor Author

qgib commented Nov 26, 2018

Author Name: Giovanni Manghi (@gioman)


  • priority_id was changed from Normal to High
  • category_id was changed from GRASS to Processing/GRASS

@qgib
Copy link
Contributor Author

qgib commented Nov 27, 2018

Author Name: Juan Manuel Perez (@juanmpd)


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 <45386331+juanmpd@users.noreply.github.com>
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,

@qgib
Copy link
Contributor Author

qgib commented Nov 27, 2018

Author Name: Giovanni Manghi (@gioman)


  • operating_system was changed from Windows 7 64 bits to
  • pull_request_patch_supplied was changed from 0 to 1

@qgib
Copy link
Contributor Author

qgib commented Nov 27, 2018

Author Name: Giovanni Manghi (@gioman)


  • operating_system was changed from to Windows

@qgib
Copy link
Contributor Author

qgib commented Nov 27, 2018

Author Name: Luigi Pirelli (@luipir)


Applied in changeset 42e30b6.


  • done_ratio was changed from 0 to 100
  • status_id was changed from Open to Closed

@qgib qgib closed this as completed Nov 27, 2018
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! High Priority GRASS Regression Something which used to work, but doesn't anymore labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! GRASS High Priority Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

No branches or pull requests

1 participant