S2 Mowing Detection Error

I am running the L4B Mowing Detection, but encounter an Error:
Traceback (most recent call last):
File “/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_s2/S2_main.py”, line 971, in
File “/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_s2/S2_main.py”, line 965, in main
do_cmpl=s4cConfig.do_cmpl, test=s4cConfig.test)
File “/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_s2/S2_main.py”, line 740, in main_run
File “/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_s2/S2_main.py”, line 222, in run_proc
burned_pixels, seg_attributes = S2_gmd.layer2mask(segmentsFile, output_vrt, segmentsOutRaster, layer_type=‘segments’, options=options_layer_burning)
File “/usr/share/sen2agri/S4C_L4B_GrasslandMowing/Bin/src_s2/S2_gmd.py”, line 416, in layer2mask
ogr_data.ExecuteSQL(‘CREATE SPATIAL INDEX ON %s’ % LayerName)
File “/home/sen2agri-service/miniconda3/envs/sen4cap/lib/python3.6/site-packages/osgeo/ogr.py”, line 800, in ExecuteSQL
return _ogr.DataSource_ExecuteSQL(self, *args, **kwargs)
RuntimeError: CreateSpatialIndex : unsupported operation on a read-only datasource.

How can I solve it?
Thank you!

Best Regards

Dear Okke,

Please see the patch that I provided here:

Best regards,

Thank you very much, it is working now!