Bug report #18103

'Random points inside polygons' fails to run

Added by Pascal Burkhard about 6 years ago. Updated about 6 years ago.

Status:Closed
Priority:Normal
Assignee:Nyall Dawson
Category:Processing/Core
Affected QGIS version:master Regression?:Yes
Operating System:MacOS 10.13.3 Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:25999

Description

When I try to run the 'random points inside polygon' algorithm in QGIS 2.99 I get the following error :

Processing algorithm...
Algorithm 'Random points inside polygons' starting...
Input parameters:
{ 'INPUT' : '/Users/admin/Downloads/TutoQGIS_Donnees/TutoQGIS_10_Representation/donnees/COMMUNE.shp', 'STRATEGY' : 0, 'EXPRESSION' : 'POPULATION * 10', 'MIN_DISTANCE' : 0, 'OUTPUT' : 'memory:' }

Traceback (most recent call last): File "/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/qgis/RandomPointsPolygons.py", line 120, in processAlgorithm raise ProcessingException( NameError: name 'ProcessingException' is not defined 

Execution failed after 0.08 seconds

The shapefile used (COMMUNE.shp) can be found here : http://ouvrir.passages.cnrs.fr/tutoqgis/donnees/TutoQGIS_10_Representation.zip

The same operation in QGIS 2.18 works and produces the desired result.

Associated revisions

Revision 8154a85f
Added by Nyall Dawson about 6 years ago

Fix Python exception in Random Points in Polygon alg

Fixes #18103

Revision a8110369
Added by Nyall Dawson about 6 years ago

[processing] Don't throw an exception if an expression cannot
be prepared

There's cases where this happens without reflecting an invalid
expression. So we can try to prepare, but not abort if the
preparation fails.

Fixes #18103

History

#1 Updated by Nyall Dawson about 6 years ago

  • Regression? changed from No to Yes
  • Status changed from Open to In Progress
  • Pull Request or Patch supplied changed from No to Yes

#2 Updated by Nyall Dawson about 6 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

#3 Updated by Pascal Burkhard about 6 years ago

  • Status changed from Closed to Reopened
  • Assignee changed from Victor Olaya to Nyall Dawson

Thanks for the rapid fix and the speed improvement! It's really nice.
I'm afraid there seems to still be an issue when using the "Selected features only" option.

I get the following error:

Algorithm 'Random points inside polygons' starting...
Input parameters:
{ 'INPUT' : QgsProcessingFeatureSourceDefinition('COMMUNE_9b930218_b760_4d43_a807_5518b5ca94b9', True), 'STRATEGY' : 0, 'EXPRESSION' : '"POPULATION"', 'MIN_DISTANCE' : 0, 'OUTPUT' : 'memory:' }

Traceback (most recent call last): File "/usr/local/Cellar/qgis3-dev/2.99/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/qgis/RandomPointsPolygons.py", line 121, in processAlgorithm self.tr('Evaluation error: {0}').format(expression.evalErrorString())) _core.QgsProcessingException: Evaluation error: 

Execution failed after 0.08 seconds

#4 Updated by Nyall Dawson about 6 years ago

  • Status changed from Reopened to Closed

#5 Updated by Giovanni Manghi about 6 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF