QGIS plugin to drive the OpenQuake Engine, to develop Social Vulnerability and Integrated Risk composite indices, and to predict building recovery times following an earthquake
It happens when attempting to use a custom field but no field is available to save the calculated value. If, on the contrary, an available field exists, it is possible to select it, and it works.
TypeError: fieldNameIndex(self, str): argument 1 has unexpected type 'QPyNullVariant'
Traceback (most recent call last):
File "/home/paolo/.qgis2/python/plugins/svir/irmt.py", line 880, in
dlg.json_cleaned.connect(lambda data: self._weights_changed(data, dlg))
File "/home/paolo/.qgis2/python/plugins/svir/irmt.py", line 939, in _weights_changed
self._recalculate_indexes(data)
File "/home/paolo/.qgis2/python/plugins/svir/irmt.py", line 970, in _recalculate_indexes
self.iface, self.iface.activeLayer(), svi_node)
File "/home/paolo/.qgis2/python/plugins/svir/calculations/calculate_utils.py", line 137, in calculate_composite_variable
get_node_attr_id_and_name(edited_node, layer)
File "/home/paolo/.qgis2/python/plugins/svir/calculations/calculate_utils.py", line 184, in get_node_attr_id_and_name
if layer.fieldNameIndex(node_attr_name) == -1: # not found
TypeError: fieldNameIndex(self, str): argument 1 has unexpected type 'QPyNullVariant'
It happens when attempting to use a custom field but no field is available to save the calculated value. If, on the contrary, an available field exists, it is possible to select it, and it works.