Allow to unregister otbApplication in python

Hello,

I have a specific, yet simple request:

Once an application is loaded, it gets cached in C++ from otbWrapperApplicationRegistry, making it impossible to reload the updated version within the same Python session. Unfortunately, it seems that CleanRegistry() does not work in my case.

I compile OTB code “Just-In-Time” from Python (ie. when no binary is present, or if the binary is older than its code). Since I store versioning information in the application’s DocTags, I need the ability to load the same application more than once, from different binaries.

Would it be possible to add a Python method to otbApplication.i that allows clearing this cache, either for a specific application or for all applications?

Thanks in advance !

Hi

I guess you can add a function to otbApplication.i using swig code, which takes care of the delete of the application pointer. It is not done in the actual code because your use case can cause problems : load the same application from different binaries would cause segfaults especially if you have multiple version of a lib that is named exactly the same but where the compiled code is different. You have to be very carefull in that case of the OTB_APPLICATION_PATH and LD_LIBRARY_PATH. You can change it via os.environ between two python calls of OTB, but this is not a good solution.

Best regards

ok, thanks, I will found a workaround.

Have a good day