Bug report #19256

Dropping an attribute causes a Python error

Added by Magnus Nilsson about 2 years ago. Updated about 2 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Processing/Modeller
Affected QGIS version:3.2 Regression?:No
Operating System:Windows 10, 64 bit Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27084

Description

When I specify an incorrect attribute (such as'a,b'c') to drop in a processing model, I get this Python error:

KeyError: '-1'

Traceback (most recent call last):
File "C:/PROGRA~1/QGIS3~1.2/apps/qgis/./python/plugins\processing\algs\qgis\DeleteColumn.py", line 84, in outputFields
input_fields.remove(index)
KeyError: '-1'

Python version: 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]
QGIS version: 3.2.0-Bonn Bonn, bc43194061

Incorrect user input should be handled better, for example by ignoring the input if the attribute doesn´t exist.

Associated revisions

Revision 85fba799
Added by Nyall Dawson about 2 years ago

[processing] Don't abort when missing field name specified in
delete columns algorithm

Fixes #19256

Revision 703a6be1
Added by Nyall Dawson about 2 years ago

[processing] Don't abort when missing field name specified in
delete columns algorithm

Fixes #19256

(cherry-picked from 85fba799)

History

#1 Updated by Nyall Dawson about 2 years ago

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

Also available in: Atom PDF