2017-11-19 15:21 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001440Orfeo Toolbox (OTB)Generalpublic2017-09-11 17:41
Reportermarineb 
Assigned Togpasero 
PriorityurgentSeverityminorReproducibilityalways
StatusresolvedResolutionno change required 
Summary0001440: Need to force string cast on SetParameterString method in python
DescriptionIn each case, when i need to set a parameter on SetParameterString(param, value) resulting form os.path.join, glob, ... , i need to cast explicitely the result with str().


I work on the cluster, with lis/1.2 which works with otb/5.10
Steps To ReproduceFor exemple :
olygonClassStatistics = otbApplication.Registry_CreateApplication("PolygonClassStatistics")
With :
PolygonClassStatistics.SetParameterString("vec", str(op.join(data_path, "Masks", "training.shp"))) works
PolygonClassStatistics.SetParameterString("vec", /work/OT/siaa/Stages/2017_snow/classification/SPOT7_MS_20170119/data/Masks/training.shp") works
But not :
PolygonClassStatistics.SetParameterString("vec", op.join(data_path, "Masks", "training.shp"))
Additional InformationMessage Error :
    PolygonClassStatistics.SetParameterString("vec", op.join(data_path, "Masks", "training.shp"))
  File "/work/logiciels/otb/rh7/5.10/lib/otb/python/otbApplication.py", line 1633, in SetParameterString
    return _otbApplication.Application_SetParameterString(self, parameter, value, hasUserValueFlag)
NotImplementedError: Wrong number or type of arguments for overloaded function 'Application_SetParameterString'.
  Possible C/C++ prototypes are:
    Application::SetParameterString(std::string,std::string,bool)
    Application::SetParameterString(std::string,std::string)
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0004275

gpasero (administrator)

I managed to reproduce the issue, but it is not linked to os.path.join(). I had no issue to use SetParameterString() with os.path.join() as argument.
The error comes from your 'data_path' variable which is most probably a unicode string. Giving a unicode string to an application is not supported, you should first encode() it using the current locale.
+Notes

-Issue History
Date Modified Username Field Change
2017-07-12 10:44 marineb New Issue
2017-09-07 17:30 gpasero Priority normal => urgent
2017-09-11 17:41 gpasero Note Added: 0004275
2017-09-11 17:41 gpasero Status new => resolved
2017-09-11 17:41 gpasero Resolution open => no change required
2017-09-11 17:41 gpasero Assigned To => gpasero
+Issue History