From 2e1f75d736b52115a7a563ee28eb3eb5caa9799e Mon Sep 17 00:00:00 2001
From: Vincent Delbar <vincent.delbar@gmail.com>
Date: Wed, 3 Apr 2024 16:58:38 +0200
Subject: [PATCH 1/3] BUG: fix error with ParameterType_Field

---
 pyotb/__init__.py | 2 +-
 pyotb/core.py     | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/pyotb/__init__.py b/pyotb/__init__.py
index 9e49b6d..a42d0fd 100644
--- a/pyotb/__init__.py
+++ b/pyotb/__init__.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 """This module provides convenient python wrapping of otbApplications."""
-__version__ = "2.0.1"
+__version__ = "2.0.2.dev1"
 
 from .install import install_otb
 from .helpers import logger, set_logger_level
diff --git a/pyotb/core.py b/pyotb/core.py
index 0b01249..228f8d2 100644
--- a/pyotb/core.py
+++ b/pyotb/core.py
@@ -1019,9 +1019,15 @@ class App(OTBObject):
             self.app.ConnectImage(key, obj.app, obj.output_image_key)
         elif isinstance(obj, otb.Application):
             self.app.ConnectImage(key, obj, get_out_images_param_keys(obj)[0])
+        # SetParameterValue in OTB<7.4 doesn't work for ram parameter (see OTB issue 2200)
         elif key == "ram":
-            # SetParameterValue in OTB<7.4 doesn't work for ram parameter cf OTB issue 2200
             self.app.SetParameterInt("ram", int(obj))
+        # SetParameterValue doesn't work with ParameterType_Field (see pyotb GitHub issue #1)
+        elif self.app.GetParameterType(key) == otb.ParameterType_Field:
+            if isinstance(obj, (list, tuple)):
+                self.app.SetParameterStringList(key, obj)
+            else:
+                self.app.SetParameterString(key, obj)
         # Any other parameters (str, int...)
         elif not isinstance(obj, (list, tuple)):
             self.app.SetParameterValue(key, obj)
-- 
GitLab


From a71820697369cd9e76a6825b6a98b6c5269ff5d8 Mon Sep 17 00:00:00 2001
From: Vincent Delbar <vincent.delbar@gmail.com>
Date: Fri, 5 Apr 2024 14:23:03 +0200
Subject: [PATCH 2/3] BUG: fix for #126

---
 pyotb/core.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/pyotb/core.py b/pyotb/core.py
index 228f8d2..b78efd4 100644
--- a/pyotb/core.py
+++ b/pyotb/core.py
@@ -665,9 +665,8 @@ class App(OTBObject):
     def get_first_key(self, param_types: list[int]) -> str:
         """Get the first param key for specific file types, try each list in args."""
         for param_type in param_types:
-            # Return the first key, from the alphabetically sorted keys of the
-            # application, which has the parameter type matching param_type.
-            for key, value in sorted(self._all_param_types.items()):
+            # Return the first key where type matches param_type.
+            for key, value in self._all_param_types.items():
                 if value == param_type:
                     return key
         raise TypeError(
-- 
GitLab


From 00127ba654e2320c3ab41263576b994b6ff891d8 Mon Sep 17 00:00:00 2001
From: Vincent Delbar <vincent.delbar@gmail.com>
Date: Fri, 5 Apr 2024 14:25:08 +0200
Subject: [PATCH 3/3] CI: bump version to 2.0.2

---
 pyotb/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyotb/__init__.py b/pyotb/__init__.py
index a42d0fd..673fd2e 100644
--- a/pyotb/__init__.py
+++ b/pyotb/__init__.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 """This module provides convenient python wrapping of otbApplications."""
-__version__ = "2.0.2.dev1"
+__version__ = "2.0.2"
 
 from .install import install_otb
 from .helpers import logger, set_logger_level
-- 
GitLab