Errors when undescore in `field` name with vector applications using python

Hello,

I have some questions about the field name provided to vector applications:

Context

Using a label column name like “code_1” fails using python but succeeds with CLI when using vector application like PolygonClassStatistics or ComputeConfusionMatrix

Configuration setup

My system: Ubuntu 20.04
Version of the OTB: 8.0
I installed the OTB with: Superbuild I have compiled with conda
Python version: 3.9

Description of my issue

The command:
otbcli_ComputeConfusionMatrix -in raster.tif -ref vector -ref.vector.in vector.shp -out mat.csv -ref.vector.field code_3
produce the expected mat.csv file.

But using the python API:

import otbApplication
ComputeConfusionMatrix = otbApplication.Registry.CreateApplication("ComputeConfusionMatrix")
ComputeConfusionMatrix.SetParameterString("in", "raster.tif")
ComputeConfusionMatrix.SetParameterString("out", "mat.csv")
ComputeConfusionMatrix.SetParameterString("ref","vector")
ComputeConfusionMatrix.SetParameterString("ref.vector.in", "vector.shp")
ComputeConfusionMatrix.UpdateParameters()
ComputeConfusionMatrix.SetParameterString("ref.vector.field", "code_3")
ComputeConfusionMatrix.ExecuteAndWriteOutput()

fails with the following error:

itk::ERROR: FieldParameter(0x7f752c06a220): Cannot find code_3

Is the use of underscore in the field name not supported with python?
Is there a convention for column names, such as the type constraint that labels must be integers that I would not have seen?

Best regards,

Benjamin

Hi !
I am a beginner and i would like to use PolygonClassStatistics and i face the same issue.
Kindly help us fix this please. Thanks!