Unable to open OTB-related .bat files (es. monteverdi.bat, mapla.bat, etc.)

Context

I’m having problems opening any .bat file inside the OTB folder.

Configuration setup

My system: Windows10 64bits
Version of the OTB: 8.1
I installed the OTB with: the binaries
QGIS version: 3.28.2
Python version: 3.6, 3.7

Description of my issue

I’m having problems opening any .bat file (eg monteverdi.bat, mapla.bat, otbgui_LSMSSegmentation.bat, etc.) located inside the OTB folder: no action with a double click; if I try to open with the terminal it gives me an error which translated into English is “windows unexpected”. As I’ve always done, I downloaded the standalone binaries for Windows, extracted them in C:\, and used to run them using mapla.bat or by double click on the single application. Both v.8.1 and the old versions don’t work (eg 8.0, which I already had on my PC and which I used until some time ago: I last used it 4-5 months ago). The only difference since then is that I added a second SSD to my PC, and placed the system folder “Documents” in it. For your information, other batch files on my PC run without any problem.
I have been using OTBtbx for 5 years but this is the first time I have encountered this problem.
Please help me!

P.S: Despite the problem with the .bat files, the modules work well on QGIS.

Hi @Jando93

I had the problem in a Windows VM, it was apparently missing an opengl dll, it is the case in some windows installations. To fix this I had to download an OPENGL dll from the OpenSource MESA project : https://downloads.fdossena.com/geth.php?r=mesa64-latest

You have to put the dll in the bin folder of the OTB install, it should work after that, let me know if it works for you

Best regards

Thanks @thibaut.romain for your answer.
I’ve just tried to put the opengl32.ddl file into the C:\OTB-8.1.0-Win64\bin folder, but the .bat files are still not working.
Very strange, because as I wrote in the post, I’ve been using OTB for years without any problem!

It’s very strange,

Can you try launching the .bat from a windows terminal? see if it outputs any log

Dear @thibaut.romain, unfortunately, I tried but the error message is C:\WINDOWS was unexpected at this time. However, I can open other .bat files not related to OTB. As I’ve already explained, the OTB modules are available in QGIS and they work well. Morever, the mapla.exe and the monteverdi.exe that are in C:\OTB-8.1.0-Win64\bin also work well.
My bad luck is that I need to launch individual modules from the terminal command line. Let me briefly explain why: I’m implementing the Residual Registration workflow (https://www.orfeo-toolbox.org/CookBook/recipes/residual_registration.html); the last step, OrthoRectification, exploits the possibility to use the Extended Filenames rule (Extended filenames — Orfeo ToolBox 8.1.0 documentation) to exchange metadata .geom file. It seems that this is possible only using the command line launch (example: otbcli_OrthoRectification -io.in slave_image?&geom=TheRefinedGeom.geom).

Actually, I’m not sure if it is possible to apply this trick from Python.

Have you tried with PowerShell or the standard windows CMD ? I remember having a problem one day with the CMD with a .bat, but it worked well with Powershell

Nevertheless, the extended filename will work in python, the same way as the CLI and QGIS does.

import otbApplication as otb

app = otb.Registry.CreateApplication("OrthoRectification")
app.SetParameterString("io.in", "slave_image?&geom=TheRefinedGeom.geom")
app.SetParameterString("io.out", "youroutput.tif")
...

app.ExecuteAndWriteOutput()
1 Like

I got the same error using PowerShell.
But the tip on python is perfect, Thanks!!!. I’ll try to implement it through python, I’ll let you know.
However, I can’t understand how could I use the extended filename on QGIS since it is a dropdown/browser menu selection.

Concerning the .bat, probably, it is an internal problem of my system. If python works, for now, it’s enough.

1 Like