Error Split-Merge no default program for .py files

Hi all,

I tried exceptionnaly the spliy-merge option for a project.
I am using ODM natively install on my Windows 10 machine.
All seems to work fine until I received an error pop-up for each submodel explaning that there are no defined app for opening “gdal_proximity.py” file. After verification it is the case on my machine no program was associated with the .py file format.
Checking the code we have:
run('gdal_proximity.py "%s" "%s" -values %s' % (geotiff_path, output_path, nodata))
So this is why it ask for a default program, adding the program could solve this issue I guess:
run('python gdal_proximity.py "%s" "%s" -values %s' % (geotiff_path, output_path, nodata))

Furthermore if we use the default programe we have no guaranty that it will be a compatible python version, it could be python 2.
Should we not provide it the path to “our” python version embedded by ODM ?

1 Like

Hey @bernarde, :hand: thanks for reporting this. It sounds like a bug. On Windows calling python gdal_proximity.py should choose the Python version needed by ODM automatically (if called within the ODM environment).

Have you tried editing the commands.py file to see if it works?

1 Like

Actually, a better approach might be to use the value of sys.executable:

import sys
run('%s gdal_proximity.py "%s" "%s" -values %s' % (sys.executable, geotiff_path, output_path, nodata))
1 Like

Ok, I have to confess that I did not try to modify it but add python as my default program for py file, my bad.

What I was reporting is that the call to run does not call python but directly the py file.
If what you said is correct (i.e. calling python necessarily calls the ODM version) then whe only need to add python to the run call.

1 Like

Yes, after checking the definition of sys.executable this should work.
Will try to confirm this during the week.

1 Like

Scratch that; there’s so many issues with calling python directly this way.

I’ve made some modifications in Adds support for OGC 3D Tiles outputs + Multi Subresolution Patch Match OpenMVS by pierotofy · Pull Request #1464 · OpenDroneMap/ODM · GitHub , try copying/pasting the new commands.py file:

https://raw.githubusercontent.com/OpenDroneMap/ODM/49d0906ce59aae0c26e63e4996a5ddcd50865b2a/opendm/dem/commands.py

1 Like