<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:16px"><div><span>Hello, Jurgen,</span></div><div id="yui_3_16_0_ym19_1_1462287696136_53294"><span><br></span></div><div dir="ltr"><span>In Windows QGIS.bat, it has also got the same content.</span></div><div dir="ltr"><span><br></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53344">@echo off</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53345">call "%~dp0\o4w_env.bat"</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53346">@echo off</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53347">path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH%</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53348">set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53349">set GDAL_FILENAME_IS_UTF8=YES</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53350">rem Set VSI cache to be used as buffer, see #6448</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53351">set VSI_CACHE=TRUE</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53352">set VSI_CACHE_SIZE=1000000</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53353">set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt4\plugins</div><div dir="ltr"></div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53354">start "QGIS" /B "%OSGEO4W_ROOT%"\bin\qgis-bin.exe %*</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53354"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53354">But, I do not know how to use this information in Python, to set runtime path.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53354"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53354">Regards.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53354"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53354">David</div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53355"><br id="yui_3_16_0_ym19_1_1462287696136_53356"></div><div dir="ltr" id="yui_3_16_0_ym19_1_1462287696136_53355"><br></div> <div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> On Wednesday, 4 May 2016, 12:50, Jürgen E. Fischer <jef@norbit.de> wrote:<br></font></div> <br><br> <div class="y_msg_container">Hi David,<br clear="none"><div class="yqt8023235634" id="yqtfd45807"><br clear="none">On Wed, 04. May 2016 at 11:43:24 +0000, David Shi wrote:<br clear="none">> How to set python search path for standalone script?<br clear="none">> <br clear="none">> I am writing a standalone script, but it can not import qgis.core and other processing. modules.</div><br clear="none"><br clear="none">In OSGeo4W there is a batch file python-qgis.bat you can pass your script to:<br clear="none"><br clear="none">@echo off<br clear="none">call "%~dp0\o4w_env.bat"<br clear="none">@echo off<br clear="none">path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH%<br clear="none">set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis<br clear="none">set GDAL_FILENAME_IS_UTF8=YES<br clear="none">rem Set VSI cache to be used as buffer, see #6448<br clear="none">set VSI_CACHE=TRUE<br clear="none">set VSI_CACHE_SIZE=1000000<br clear="none">set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt4\plugins<br clear="none">set PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python;%PYTHONPATH%<br clear="none">"%OSGEO4W_ROOT%"\bin\python.exe %*<br clear="none"><br clear="none">PYTHONPATH and QGIS_PREFIX_PATH are most important.<br clear="none"><br clear="none"><br clear="none">Jürgen<br clear="none"><br clear="none">-- <br clear="none">Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31<br clear="none">Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50<br clear="none">Software Engineer D-26506 Norden <a shape="rect" href="http://www.norbit.de/" target="_blank">http://www.norbit.de</a><br clear="none">QGIS release manager (PSC) Germany IRC: jef on FreeNode <br>_______________________________________________<br clear="none">Qgis-user mailing list<br clear="none"><a shape="rect" ymailto="mailto:Qgis-user@lists.osgeo.org" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br clear="none">List info: <a shape="rect" href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br clear="none">Unsubscribe: <a shape="rect" href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br><br></div> </div> </div> </div></div></body></html>