L4B AttributeError

Dear community,

I want to start the L4B processor, but it seems to fail with an AttributeError within the src_s1/S1_main.py script. I used the following lines to start the L4B for S1:

/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/grassland_mowing.sh --script-path /usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_s1/S1_main.py --site-id 1 --config-file /usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_ini/S4C_L4B_Default_Config.cfg --input-shape-file /mnt/archive/orchestrator_temp/s4c_l4b/1152/43883-s4c-grassland-gen-input-shp/SEN4CAP_L4B_GeneratedInputShp.shp --output-data-dir /mnt/archive/orchestrator_temp/s4c_l4b/1152/43885-s4c-grassland-mowing/SEN4CAP_L4B_S1_OutputData --start-date "2020-01-01" --end-date "2020-07-15" --seg-parcel-id-attribute NewID --output-shapefile /mnt/archive/orchestrator_temp/s4c_l4b/1152/43886-product-formatter/SEN4CAP_L4B_S1_S2_MowingDetection.shp --do-cmpl True --test True --season-start "2020-01-01" --season-end "2020-11-15"

The execution started but stopped soon afterwards with this Error:

directory  /mnt/archive/orchestrator_temp/s4c_l4b/1152/43885-s4c-grassland-mowing/SEN4CAP_L4B_S1_OutputData  exists...moving on
directory  /mnt/archive/orchestrator_temp/s4c_l4b/1152/43885-s4c-grassland-mowing/SEN4CAP_L4B_S1_OutputData/tmp  exists...moving on
Traceback (most recent call last):
  File "/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_s1/S1_main.py", line 852, in <module>
    main()
  File "/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_s1/S1_main.py", line 846, in main
    do_cmpl=s4cConfig.do_cmpl, test=s4cConfig.test)
  File "/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_s1/S1_main.py", line 585, in main_run
    compliancy_conf_file=configFile)
  File "/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_s1/S1_main.py", line 140, in run_proc
    Layer = ogr_data.GetLayer(0)
AttributeError: 'NoneType' object has no attribute 'GetLayer'

Can someone make sense about that and help us out here?

Kind regards,
Jonathan

Dear Jonathan,

From what I see, you are trying to run a command got from a previous custom or scheduled execution.
But please note that upon a previous successful execution, the intermediate files are deleted and in your case, the input shapefile used as parameter and obtained from a previous step (/mnt/archive/orchestrator_temp/s4c_l4b/1152/43883-s4c-grassland-gen-input-shp/SEN4CAP_L4B_GeneratedInputShp.shp) does not exists anymore.
Indeed, the error is not intuitive and it will be corrected in the next version (the correction was made also on your machine such that you will get from the start the error “ERROR: the file for input-shape-file does not exists!!! Exiting …”).
So, in order to be able to run the command above you should actually run before the following command:

/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/generate_grassland_mowing_input_shp.sh -s 1 -y 2020 -o /mnt/archive/orchestrator_temp/s4c_l4b/1152/43883-s4c-grassland-gen-input-shp/SEN4CAP_L4B_GeneratedInputShp.shp -p /usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/generate_grassland_mowing_input_shp.py

And then your command:

/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/grassland_mowing.sh --script-path /usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_s1/S1_main.py --site-id 1 --config-file /usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_ini/S4C_L4B_Default_Config.cfg --input-shape-file /mnt/archive/orchestrator_temp/s4c_l4b/1152/43883-s4c-grassland-gen-input-shp/SEN4CAP_L4B_GeneratedInputShp.shp --output-data-dir /mnt/archive/orchestrator_temp/s4c_l4b/1152/43885-s4c-grassland-mowing/SEN4CAP_L4B_S1_OutputData --start-date “2020-01-01” --end-date “2020-07-15” --seg-parcel-id-attribute NewID --output-shapefile /mnt/archive/orchestrator_temp/s4c_l4b/1152/43886-product-formatter/SEN4CAP_L4B_S1_S2_MowingDetection.shp --do-cmpl True --test True --season-start “2020-01-01” --season-end “2020-11-15”

Best regards,
Cosmin