I am using a python code (command subprocess.run(arg_list)) to invoke the SNAP gpt command.
I get the following error:
java.nio.file.InvalidPathException: Illegal char <:> at index 50: C:\ProgramData\Anaconda3\Library\bin\gdalinfo.exeC:\Program Files\GDAL\gdalinfo.exeC:\ProgramData\Anaconda3\envs\aitlas_s2\Lib\site-packages\osgeo\gdalinfo.exe
It is obvious that java searches for all the gdalinfo.exe files (in my case three files are found), and then ‘glues’ them together in one long path without delimeter, which then throws the exception.
Yes, all three GDAL paths are present in the PATH System variable, as expected.
The problem is that in gpt call of SNAP 8.0 those three paths are concatenated into one, so the error is thrown.
With SNAP 7.0 the same three GDAL paths were also present in the PATH System variable, however their concatenation did not occur, so the call of gpt was ok.
Hello,
The difference between SNAP 7.0 and 8.0 is that SNAP 7.0 used only the internal GDAL (within SNAP).
SNAP 8.0 is also capable to use an installed version of GDAL (if any compatible version found). In case of no GDAL version installed, the internal GDAL within SNAP will be used.
The cause of your problem is that several versions of GDAL are found in the PATH environment variable, and only one is allowed. (SNAP cannot decide which version to use)
The solution for you is to clean the PATH variable and let only one path towards one version of GDAL.
Oana, thanks for the answer.
It is a comon practice to have several GDALs on the computer. So for future version I suggest that the present solution is changed.
Now, when I just removed the 2 (out of 3) paths to GDAL from the PATH System variables, the change is not in the effect, since SNAP is already “built”/integrated with 3 GDALs. Is there a way to invoke a sort of re-built process of SNAP with the netBeans Platform? Or must I de-install SNAP 8.0 and install it again?
No, there is no need to re-install SNAP 8.0 again.
What you can do is to close SNAP, delete all cache, and restart SNAP.
For cache delete, try to clean:
C:\Users\[username]\.snap
C:\Users\[username]\AppData\Roaming\SNAP or C:\Users\[username]\AppData\Local\SNAP
C:\Users\[username]\AppData\Local\Temp\snap-[username]
Also, from Tools -> Options -> S2TBX, you can choose which GDAL shall be used (in your case maybe the problem will solve by just using the internal GDAL - first option):
True, but only one should be available at one time, in PATH.
No, SNAP has only one internal GDAL, the default option is to use the user installed GDAL version, you had 3 declared in PATH, but this has no relation with the GDAL that SNAP was build with.
Thany you!
For me it worked only the first of your suggestions: to clean the PATH variable of paths to all (!) GDAL versions. This results in the fact that the internal GDAL within SNAP is used.