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

Error in Ubuntu 22.04.4 LTS :- cannot access free variable 'd_f' where it is not associated with a value in enclosing scope #92

Closed ved-ux closed 1 month ago

ved-ux commented 1 month ago

QGIS version: 3.28.8-Firenze Qt version: 5.15.8 Python version: 3.11.4 GDAL version: 3.7.0 GEOS version: 3.11.2-CAPI-1.17.2 PROJ version: Rel. 9.2.1, June 1st, 2023 PDAL version: 2.5.5 (git-version: 9d28a2) Algorithm started at: 2024-05-18T08:21:51 Algorithm '2_GenerateSwmmInpFile' starting… Input parameters: { 'FILE_CONDUITS' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_SWMM_conduits.gpkg', 'FILE_CURVES' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/Reclassify_shp/shp_s2/shp_s2/BRPL_S2_gisswmm_curves.xls', 'FILE_DIVIDERS' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_SWMM_dividers.gpkg', 'FILE_INFLOWS' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/Reclassify_shp/shp_s2/shp_s2/BRPL_S2_gisswmm_inflows.xls', 'FILE_JUNCTIONS' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_SWMM_junctions.gpkg', 'FILE_OPTIONS' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_gisswmm_options.xlsx', 'FILE_ORIFICES' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_SWMM_orifices.gpkg', 'FILE_OUTFALLS' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_SWMM_outfalls.gpkg', 'FILE_OUTLETS' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_SWMM_outlets.gpkg', 'FILE_PATTERNS' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/Reclassify_shp/shp_s2/shp_s2/BRPL_S2_gisswmm_patterns.xls', 'FILE_PUMPS' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_SWMM_pumps.gpkg', 'FILE_QUALITY' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/Reclassify_shp/shp_s2/shp_s2/BRPL_S2_gisswmm_quality.xls', 'FILE_RAINGAGES' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_SWMM_raingages.gpkg', 'FILE_STORAGES' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_SWMM_storages.gpkg', 'FILE_STREETS' : '', 'FILE_SUBCATCHMENTS' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_SWMM_subcatchments.gpkg', 'FILE_TIMESERIES' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/Reclassify_shp/shp_s2/shp_s2/BRPL_S2_gisswmm_timeseries.xls', 'FILE_TRANSECTS' : '', 'FILE_WEIRS' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/5_2_SWMM_weirs.gpkg', 'QGIS_OUT_INP_FILE' : '/home/wrf_hydro_fnl/SWMM_input_files/BRPL_work/qgis_swmm_test_del/inp_test.inp' }

Reading geodata: layer: 5_2_SWMM_raingages layer: 5_2_SWMM_outfalls layer: 5_2_SWMM_storages layer: 5_2_SWMM_subcatchments layer: 5_2_SWMM_conduits layer: 5_2_SWMM_junctions layer: 5_2_SWMM_pumps layer: 5_2_SWMM_weirs layer: 5_2_SWMM_orifices layer: 5_2_SWMM_outlets layer: 5_2_SWMM_dividers done

Reading tables... Table: OPTIONS Table: Control Table: Pump1 Table: Pump2 Table: Pump3 Table: Pump4 Table: Pump5 Table: Storage Table: Rating Table: Weir Table: Tidal Table: Diversion Table: Shape Table: HOURLY Table: DAILY Table: MONTHLY Table: WEEKEND Table: Direct Table: Dry_Weather Table: Hydrographs Table: RDII Table: TIMESERIES Table: POLLUTANTS Table: LANDUSES Table: COVERAGES Table: LOADINGS done

preparing data for input file: [OPTIONS] section [SUBCATCHMENTS] section [CONDUITS] section [PUMPS] section [WEIRS] section [OUTLETS] section [ORIFICES] section [JUNCTIONS] section [OUTFALLS] section [STORAGES] section [DIVIDERS] section [INFLOWS] section [CURVES] section [PATTERNS] section **[TIMESERIES] section Traceback (most recent call last): File "/home/wrf_hydro_fnl/.local/share/QGIS/QGIS3/profiles/default/python/plugins/generate_swmm_inp/generate_swmm_inp_file.py", line 777, in processAlgorithm 'data': get_timeseries_from_table( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/wrf_hydro_fnl/.local/share/QGIS/QGIS3/profiles/default/python/plugins/generate_swmm_inp/g_s_various_functions.py", line 258, in get_timeseries_from_table ts_df['Time'] = adjust_datetime( ^^^^^^^^^^^^^^^^ File "/home/wrf_hydro_fnl/.local/share/QGIS/QGIS3/profiles/default/python/plugins/generate_swmm_inp/g_s_various_functions.py", line 202, in adjust_datetime dt_val_list = [QTime.fromString(dt_val, d_f) for dt_val in dt_list] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/wrf_hydro_fnl/.local/share/QGIS/QGIS3/profiles/default/python/plugins/generate_swmm_inp/g_s_various_functions.py", line 202, in dt_val_list = [QTime.fromString(dt_val, d_f) for dt_val in dt_list] ^^^ NameError: cannot access free variable 'd_f' where it is not associated with a value in enclosing scope

Execution failed after 0.53 seconds**

Loading resulting layers Algorithm '2_GenerateSwmmInpFile' finished

ved-ux commented 1 month ago

Please let me know if I need to provide additional information.

Jannik-Schilling commented 1 month ago

sorry that´s a typo in the code.

See: https://github.com/Jannik-Schilling/generate_swmm_inp/compare/main...dev_0_36#diff-40053d9eb18099922237798715c5b5fe0e3ef15a2eb450e45281a715093e877e

you can either change that line in the code manually for your installed version of the plugin or install version 0.36 from here (dowload zip https://github.com/Jannik-Schilling/generate_swmm_inp/tree/dev_0_36, delete the old version of the plugin and reinstall the plugin from the zip file)

Jannik-Schilling commented 1 month ago

dd888ac will be published on the official plugin repository soon

ved-ux commented 1 month ago

Dear Jannik,

I'm sorry for not getting back to you sooner. I tried the .zip file, and it worked.

Thank you.