Bug report #12183

Processing refactor fields: python error after trying to add a new field

Added by Filipe Dias over 9 years ago. Updated over 9 years ago.

Status:Closed
Priority:Normal
Assignee:Victor Olaya
Category:Processing/QGIS
Affected QGIS version:2.6.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:20373

Description

Click "add a new field", set its "precision", "length" and "type"

Select this field and click "delete selected field"

Click "Add a new field" again

Double on "name" and this Python error appears:

An error has occured while executing Python code:

Traceback (most recent call last):
File "/usr/share/qgis/python/plugins/processing/algs/qgis/ui/FieldsMappingPanel.py", line 137, in data
return self.fieldTypes[value]
KeyError: None

Python version:
2.7.6 (default, Mar 22 2014, 23:03:41)
[GCC 4.8.2]

QGIS version:
2.7.0-Master Master, exported

Python path: ['/usr/share/qgis/python/plugins/processing', '/home/fd/.qgis2/python/plugins/processinglwgeomprovider', '/home/fd/.qgis2/python/plugins/LecoS', '/usr/share/qgis/python', u'/home/fd/.qgis2/python', u'/home/fd/.qgis2/python/plugins', '/usr/share/qgis/python/plugins', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', u'/home/fd/.qgis2//python', '/usr/share/qgis/python/plugins/fTools/tools', '/home/fd/.qgis2/python/plugins/MetaSearch/ext-libs']

sample.zip (2.27 KB) Filipe Dias, 2015-02-11 02:50 AM

Associated revisions

Revision ed94aff1
Added by Arnaud Morvan over 9 years ago

Fix #12183 - avoid error message in fieldsmapper when no field type selected

History

#1 Updated by Arnaud Morvan over 9 years ago

After edit on field type, if none selected, set model data to QtCore.QVariant.Invalid which is correctly handled in model.data method.
Pull request: https://github.com/qgis/QGIS/pull/1897

#2 Updated by Arnaud Morvan over 9 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF