<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Dear list,</div><div><br></div><div>In a python plugin, I need to call an external command line tool (docker) through subprocess.</div><div><br></div><div>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 :<br></div><div><br></div><div>

<div style="color:rgb(248,248,242);background-color:rgb(39,40,34);font-family:Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(249,38,114)">REM</span><span style="color:rgb(117,113,94)"> start with clean path</span></div><div><span style="color:rgb(249,38,114)">set</span><span style="color:rgb(248,248,242)"> </span><span style="color:rgb(248,248,242)">path</span><span style="color:rgb(249,38,114)">=</span><span style="color:rgb(248,248,242)">%OSGEO4W_ROOT%</span><span style="color:rgb(248,248,242)">\bin;</span><span style="color:rgb(248,248,242)">%WINDIR%</span><span style="color:rgb(248,248,242)">\system32;</span><span style="color:rgb(248,248,242)">%WINDIR%</span><span style="color:rgb(248,248,242)">;</span><span style="color:rgb(248,248,242)">%WINDIR%</span><span style="color:rgb(248,248,242)">\system32\WBem</span></div></div>

</div><div><br></div><div><br></div><div>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.</div><div><br></div><div>What is the recommend way to do it ?<br></div><div><br></div><div>I found that old thread : 
<a href="https://gis.stackexchange.com/questions/107204/system-variable-path-overwritten-in-qgis">https://gis.stackexchange.com/questions/107204/system-variable-path-overwritten-in-qgis</a> where there's a suggestion to retrieve the path from the registry. But that looks a bit fragile (and windows only).</div><div><br></div><div>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).</div><div><br></div><div>
 Would it be an option to keep a copy of the original path env var, that could be used when needed in the code ?

</div><div><br></div>Thanks !!</div><div dir="ltr"><br></div><div>Olivier<br></div></div></div></div>