Dear list,

In a python plugin, I need to call an external command line tool (docker)
through subprocess.

However, it seems this is not as easy as it seem, as at least on Windows,
the system path is reset on startup. I think this happens in o4w_env.bat :

REM start with clean path
set path=%OSGEO4W_ROOT%\bin;%WINDIR%\system32;%WINDIR%;%WINDIR%
\system32\WBem


I understand the idea behind this, as it probably avoids some complicated
issues of conflicting tools. But it also makes it hard to use external
tools.

What is the recommend way to do it ?

I found that old thread :
https://gis.stackexchange.com/questions/107204/system-variable-path-overwritten-in-qgis
where there's a suggestion to retrieve the path from the registry. But that
looks a bit fragile (and windows only).

Another one could be to add a setting in the plugin to specify the path of
the executable, but this is relatively technical (you need to explain to
the user where to find the executable, which will be hard especially if
it's not in a standard place).

Would it be an option to keep a copy of the original path env var, that
could be used when needed in the code ?

Thanks !!

Olivier
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to