Jannik-Schilling / generate_swmm_inp

a QGIS plugin for the import and export of SWMM input files (conversion of geodata, e.g. shapefiles or geopackage into SWMM models and vice versa)
GNU General Public License v2.0
35 stars 10 forks source link

Improve Error Messages #95

Open MikeDowner opened 3 weeks ago

MikeDowner commented 3 weeks ago

Hi, I am getting errors when I try and generate the inp and can’t find why. Error message below. Could you take a look as point me in the right direction? Much appreciated.

Reading geodata: layer: TOSTM_WW_Trunk_Pipes layer: TOSTM_WW_Trunk_Features1 Traceback (most recent call last): File "C:\Users/Mike.Roberts/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\generate_swmm_inp\generate_swmm_inp_file.py", line 322, in processAlgorithm raw_data_dict = read_layers_direct(raw_layers_dict, feedback = feedback) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users/Mike.Roberts/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\generate_swmm_inp\g_s_read_write_data.py", line 139, in read_layers_direct data_dict = {n: load_layer_to_df(d, select_cols, with_id, feedback) for n, d in raw_layers_dict.items() if d is not None} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users/Mike.Roberts/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\generate_swmm_inp\g_s_read_write_data.py", line 113, in load_layer_to_df

Execution failed after 0.06 seconds

Jannik-Schilling commented 3 weeks ago

Hi Mike, I renamed this issue, because the error message seems be misleading and I'll improve that.

plugins\generate_swmm_inp\g_s_read_write_data.py", line 113, in load_layer_to_df vlayer.name()+': '+', '.join(name_missing_geom) TypeError: sequence item 0: expected str instance, QVariant found

...indicates that two things are incorrect, here:

  1. The feedback message of the plugin can not be generated because of a QVariant value (most likely a NULL in QGIS) in the names column of the layer "TOSTM_WW_Trunk_Features1". So please check if all features have a unique name (text / string), because this is the main identifier for the feature
  2. The tool tries to generate this feedback message because at least one feature has no geometry (or an invalid geometry). You can use the processing tools "Remove null geometries" and "Check validity" for this task.