Question: I am trying to extract individual LID settings for each subcatchment in SWMM using LID_USAGE from the swmm_api package. I have followed the example at https://markuspichler.gitlab.io/swmm_api/examples/how_to_add_LIDs.html, however, an error occurs. I wonder how to fix the code? I have attached the swmm model for your reference, thank you. The example SWMM model (input file) is available at https://1drv.ms/u/s!AnVl_zW00EHemH5cu620m6vxqXdN?e=S5VSCA. I am using swmm-api 0.4.37. from swmm_api import SwmmInput from swmm_api.input_file.section_labels import SUBAREA,SUBCATCHMENTS,LID_CONTROLS,LID_USAGE import numpy as np import pandas as pd inp = SwmmInput.read_file('Example2.inp') inp.LID_CONTROLS # LID_CONTROLS works smoothly! inp.LID_USAGE # LID_USAGE is not working...   inp.LID_USAGE Traceback (most recent call last): File C:\ProgramData\miniconda3\envs\swmm\lib\site-packages\swmm_api\input_file\helpers.py:780 in from_inp_line return cls(*line_args) TypeError: __init__() takes from 8 to 12 positional arguments but 17 were given During handling of the above exception, another exception occurred: Traceback (most recent call last): Cell In[6], line 1 inp.LID_USAGE File C:\ProgramData\miniconda3\envs\swmm\lib\site-packages\swmm_api\input_file\inp.py:948 in LID_USAGE return self[LID_USAGE] File C:\ProgramData\miniconda3\envs\swmm\lib\site-packages\swmm_api\input_file\inp.py:193 in __getitem__ self._convert_section(key) File C:\ProgramData\miniconda3\envs\swmm\lib\site-packages\swmm_api\input_file\inp.py:214 in _convert_section self._data[key] = convert_section(key, self._data[key], self._converter) File C:\ProgramData\miniconda3\envs\swmm\lib\site-packages\swmm_api\input_file\helpers.py:939 in convert_section return section_.from_inp_lines(lines) File C:\ProgramData\miniconda3\envs\swmm\lib\site-packages\swmm_api\input_file\helpers.py:849 in from_inp_lines return cls.create_section(lines) File C:\ProgramData\miniconda3\envs\swmm\lib\site-packages\swmm_api\input_file\helpers.py:831 in create_section sec.add_inp_lines(lines_iter) File C:\ProgramData\miniconda3\envs\swmm\lib\site-packages\swmm_api\input_file\helpers.py:360 in add_inp_lines self.add_multiple(*self._section_object._convert_lines(multi_line_args)) File C:\ProgramData\miniconda3\envs\swmm\lib\site-packages\swmm_api\input_file\helpers.py:866 in _convert_lines yield cls.from_inp_line(*line_args) File C:\ProgramData\miniconda3\envs\swmm\lib\site-packages\swmm_api\input_file\helpers.py:782 in from_inp_line raise TypeError(f'{e} | {cls.__name__}{line_args}\n\n__init__{signature(cls.__init__)}\n\n{getdoc(cls.__init__)}') TypeError: __init__() takes from 8 to 12 positional arguments but 17 were given | LIDUsage('2', 'Bioretention', '1', '5000', '0', '10', '70', '1', '"E:\\Python', 'Examples\\SWMM', 'Calibration\\Example-Yang\\For', 'Calibration\\LID', 'Reports\\S2', 'Bioretention.txt"', '*', '0') __init__(self, subcatchment, lid, n_replicate, area, width, saturation_init, impervious_portion, route_to_pervious=0, fn_lid_report=nan, drain_to=nan, from_pervious=nan) Assignment of LID controls to subcatchments. Args: subcatchment (str): Name of the subcatchment using the LID process. lid (str): Name of an LID process defined in the [LID_CONTROLS] section. n_replicate (int): Number of replicate LID units deployed. area (float): Area of each replicate unit (ft^2 or m^2 ). width (float): Width of the outflow face of each identical LID unit (in ft or m). This parameter applies to roofs, pavement, trenches, and swales that use overland flow to convey surface runoff off of the unit. It can be set to 0 for other LID processes, such as bio-retention cells, rain gardens, and rain barrels that simply spill any excess captured runoff over their berms. saturation_init (float): For bio-retention cells, rain gardens, and green roofs this is the degree to which the unit's soil is initially filled with water (0 % saturation corresponds to the wilting point moisture content, 100 % saturation has the moisture content equal to the porosity). The storage zone beneath the soil zone of the cell is assumed to be completely dry. For other types of LIDs it corresponds to the degree to which their storage zone is initially filled with water impervious_portion (float): Percent of the impervious portion of the subcatchment’s non-LID area whose runoff is treated by the LID practice. (E.g., if rain barrels are used to capture roof runoff and roofs represent 60% of the impervious area, then the impervious area treated is 60%). If the LID unit treats only direct rainfall, such as with a green roof, then this value should be 0. If the LID takes up the entire subcatchment then this field is ignored. route_to_pervious (int): A value of 1 indicates that the surface and drain flow from the LID unit should be routed back onto the pervious area of the subcatchment that contains it. This would be a common choice to make for rain barrels, rooftop disconnection, and possibly green roofs. The default value is 0. fn_lid_report (str): Optional name of a file to which detailed time series results for the LID will be written. Enclose the name in double quotes if it contains spaces and include the full path if it is different than the SWMM input file path. Use ‘*’ if not applicable and an entry for DrainTo follows drain_to (str): Optional name of subcatchment or node that receives flow from the unit’s drain line, if different from the outlet of the subcatchment that the LID is placed in. from_pervious (float): optional percent of the pervious portion of the subcatchment’s non-LID area whose runoff is treated by the LID practice. The default value is 0  .

Answer: This message from the error says what the issue is: TypeError: __init__() takes from 8 to 12 positional arguments but 17 were given  You are providing information that the program does not know how to parse, because it is only designed for 8-12 parameters. Why are you inputting 5 extra parameters- what are they for? You are providing too many inputs for the input file. You can find details of the input file from the documentation on page 296. These are the recommended parameters: Subcat, LID, Number, Area, Width, InitSat, FromImp, ToPerv, RptFile, DrainTo  And here is an example of how the input could be structured for the input file: [LID_USAGE] ;; assigning lid controls to subcatchments ;;Subcatchment LID Process Number Area Width InitSat FromImp ToPerv RptFile DrainTo FromPerv Sub1 BioCell 5 500 100 0 0 0 "example.txt" * 0  EDIT: The above comment was accurate, but the solution did not properly diagnose your issue. After looking at your files, you have filepaths like this for your RptFile: "E:\Python Examples\SWMM Calibration\Example-Yang\For Calibration\LID Reports\S2 Bioretention.txt"  Shown here:  Python cannot properly interpret this kind of path and often incorrectly splits it into multiple lines; this is why you are getting an error regarding too many arguments. If Python interpreted this as a single path, you would not be getting the error. So that's the solution: adjust the file paths to have no spaces, then copy-paste into your input file accordingly. I used this file path: /Users/USER/Desktop/swmm_example/example.txt  and ran your code with no issues.