2

I'm running a custom model from in batch mode. It has the following tools:

  • Raster Calculator
  • Polygonize (raster to vector) (GDAL)
  • Simplify
  • A lot of field calculators
  • Drop field(s) (the final tool in the model)

During batch model processing, the name of the model output (a vector layer) is calculated by the following expression:

'/MyProject/' || 'ResearchArea' || '/'  ||  
regexp_substr(file_path(@my_raster_input), 'mu_0.\\\\d+') || 
regexp_substr(file_path(@my_raster_input), 'turb_\\\\d+') || 
'.geojson'

When I run my model in the normal way, I get no errors, but when running batch processing, the following appears in my log file for every item in the run:

The following layers were not correctly generated.
• /MyProject/ResearchArea/mu_0.125_turb_500.geojson
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.

The log messages panel says the following:

 CRITICAL    Error loading result layer:
             Traceback (most recent call last):
              File "/QGIS33~1.2/apps/qgis/./python/plugins\processing\gui\Postprocessing.py", line 229, in handleAlgorithmResults
              results_group = get_layer_tree_results_group(details, context)
              File "/QGIS33~1.2/apps/qgis/./python/plugins\processing\gui\Postprocessing.py", line 154, in get_layer_tree_results_group
              results_group = details.project.layerTreeRoot()
             AttributeError: 'NoneType' object has no attribute 'layerTreeRoot'

I know that a layerTree has to do with the legend widget in QGIS. But I have no clue how this relates to the model I use. Interestingly, when I open the resulting .geojson files, they can be used as normal and don't seem corrupt. Nevertheless, the error does not allow to run the entire batch from start to end.

How can I fix this AttributeError (preferably within the model designer)? I'm using version 3.32 Lima.

1 Answer 1

2

This issue may very well be a bug in the software. I noticed that the error does not appear when you tick the option load layers upon completion. The drawback is that you do get all the generated layers in your project, but on the other hand, it is a minor nuisance compared to not being able to use batch-mode at all. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.