Re: [Qgis-user] How to set python search path for standalone script?
Hello, Jurgen, It only worked once. Then, it can not find other modules. How to set a top level path, so that Python will look for modules in any sub-directories. Regards. David On Wednesday, 4 May 2016, 13:45, David Shi wrote: Do you mean run python-qgis.bat in command window?Then, run my script?Regards.David On Wednesday, 4 May 2016, 13:14, Jürgen E. Fischer wrote: Hi David, On Wed, 04. May 2016 at 12:07:51 +, David Shi wrote: > Thank you. > I am using QGIS in Windows. Do I need to set paths? No, run python-qgis.bat yourscript Jürgen -- Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31 Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50 Software Engineer D-26506 Norden http://www.norbit.de ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] How to set python search path for standalone script?
Do you mean run python-qgis.bat in command window?Then, run my script?Regards.David On Wednesday, 4 May 2016, 13:14, Jürgen E. Fischer wrote: Hi David, On Wed, 04. May 2016 at 12:07:51 +, David Shi wrote: > Thank you. > I am using QGIS in Windows. Do I need to set paths? No, run python-qgis.bat yourscript Jürgen -- Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31 Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50 Software Engineer D-26506 Norden http://www.norbit.de ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] How to set python search path for standalone script?
Hello, Jurgen, In Windows QGIS.bat, it has also got the same content. @echo offcall "%~dp0\o4w_env.bat"@echo offpath %OSGEO4W_ROOT%\apps\qgis\bin;%PATH%set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgisset GDAL_FILENAME_IS_UTF8=YESrem Set VSI cache to be used as buffer, see #6448set VSI_CACHE=TRUEset VSI_CACHE_SIZE=100set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt4\pluginsstart "QGIS" /B "%OSGEO4W_ROOT%"\bin\qgis-bin.exe %* But, I do not know how to use this information in Python, to set runtime path. Regards. David On Wednesday, 4 May 2016, 12:50, Jürgen E. Fischer wrote: Hi David, On Wed, 04. May 2016 at 11:43:24 +, David Shi wrote: > How to set python search path for standalone script? > > I am writing a standalone script, but it can not import qgis.core and other > processing. modules. In OSGeo4W there is a batch file python-qgis.bat you can pass your script to: @echo off call "%~dp0\o4w_env.bat" @echo off path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH% set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis set GDAL_FILENAME_IS_UTF8=YES rem Set VSI cache to be used as buffer, see #6448 set VSI_CACHE=TRUE set VSI_CACHE_SIZE=100 set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt4\plugins set PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python;%PYTHONPATH% "%OSGEO4W_ROOT%"\bin\python.exe %* PYTHONPATH and QGIS_PREFIX_PATH are most important. Jürgen -- Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31 Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50 Software Engineer D-26506 Norden http://www.norbit.de QGIS release manager (PSC) Germany IRC: jef on FreeNode ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] How to set python search path for standalone script?
Hi David, On Wed, 04. May 2016 at 12:07:51 +, David Shi wrote: > Thank you. > I am using QGIS in Windows. Do I need to set paths? No, run python-qgis.bat yourscript Jürgen -- Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31 Dipl.-Inf. (FH) Rheinstraße 13Fax. +49-4931-918175-50 Software Engineer D-26506 Norden http://www.norbit.de pgpsKLJ2liRX1.pgp Description: PGP signature ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] How to set python search path for standalone script?
Hello, Jürgen Thank you. I am using QGIS in Windows. Do I need to set paths? Regards. David On Wednesday, 4 May 2016, 12:49, Jürgen E. Fischer wrote: Hi David, On Wed, 04. May 2016 at 11:43:24 +, David Shi wrote: > How to set python search path for standalone script? > > I am writing a standalone script, but it can not import qgis.core and other > processing. modules. In OSGeo4W there is a batch file python-qgis.bat you can pass your script to: @echo off call "%~dp0\o4w_env.bat" @echo off path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH% set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis set GDAL_FILENAME_IS_UTF8=YES rem Set VSI cache to be used as buffer, see #6448 set VSI_CACHE=TRUE set VSI_CACHE_SIZE=100 set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt4\plugins set PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python;%PYTHONPATH% "%OSGEO4W_ROOT%"\bin\python.exe %* PYTHONPATH and QGIS_PREFIX_PATH are most important. Jürgen -- Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31 Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50 Software Engineer D-26506 Norden http://www.norbit.de QGIS release manager (PSC) Germany IRC: jef on FreeNode ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] How to set python search path for standalone script?
Hi David, On Wed, 04. May 2016 at 11:43:24 +, David Shi wrote: > How to set python search path for standalone script? > > I am writing a standalone script, but it can not import qgis.core and other > processing. modules. In OSGeo4W there is a batch file python-qgis.bat you can pass your script to: @echo off call "%~dp0\o4w_env.bat" @echo off path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH% set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis set GDAL_FILENAME_IS_UTF8=YES rem Set VSI cache to be used as buffer, see #6448 set VSI_CACHE=TRUE set VSI_CACHE_SIZE=100 set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt4\plugins set PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python;%PYTHONPATH% "%OSGEO4W_ROOT%"\bin\python.exe %* PYTHONPATH and QGIS_PREFIX_PATH are most important. Jürgen -- Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31 Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50 Software Engineer D-26506 Norden http://www.norbit.de QGIS release manager (PSC) GermanyIRC: jef on FreeNode pgpie8lN_1CnB.pgp Description: PGP signature ___ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user