I am trying to run v.clean through GRASS 7.6.1 using QGIS 3.10 and Python 3.7 on a line shapefile. I have tried with the output both saving to a file location and as a temporary file, and the error is the same.

Input Parameters:

{ '-b' : False, '-c' : False, 'GRASS_MIN_AREA_PARAMETER' : 0.0001, 
'TEMPORARY_OUTPUT', 'input' : 'C:/file.shp', 'output' : 'TEMPORARY_OUTPUT', 'threshold' : 
'1', 'tool' : [1], 'type' : [1] }

Error message:

File "C:\Python37\Lib\site.py", line 177
SyntaxError: invalid syntax
Press any key to continue . . .
File "C:\Python37\Lib\site.py", line 177
SyntaxError: invalid syntax
Press any key to continue . . .
Execution completed in 2.32 seconds
{'error': <QgsProcessingOutputLayerDefinition {'sink':TEMPORARY_OUTPUT, 'createOptions': {'fileEncoding': 'System'}}>,
'output': <QgsProcessingOutputLayerDefinition {'sink':TEMPORARY_OUTPUT, 'createOptions': {'fileEncoding': 'System'}}>}

The closest answer I could find was an issue with using Python 2 instead of 3, but I am definitely using Python 3.7. I have had issues with that in the past, and made sure to run this both with my regular file names and renaming the path for 2.7 to be sure it's not accidentally using Python 2.

  • Did you try with grass 7.8? grass.osgeo.org/download/software
    – Victor
    Commented Nov 30, 2019 at 7:21
  • @Victor I don't know how to run 7.8 through QGIS
    – jyingling
    Commented Dec 2, 2019 at 18:25
  • Can you include the output from the Python Console in QGIS for import sys; print(sys.version)? Commented Dec 3, 2019 at 0:17

1 Answer 1


I haven't used GRASS before, but the python error message looks familiar, at times when I've used incompatible scripts (e.g. something written for 2.x, but run in 3.x, or vice-versa). I know you've mentioned the discrepancy in your post, but have you tried running the same operation using 2.x? The python installation may have added env variables that automatically run a particular python installation from one of the install directories (i.e. 2.x install or 3.x install). You may have to explicitly include the full path to the python version you'd like to target (e.g. c:\Python27\python.exe).

  • 1
    Running in 2.7 worked - had to force 2.7 by changing the path to 3.7 and then it worked to run through QGIS.
    – jyingling
    Commented Dec 3, 2019 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.