errors with QGIS API USING PYTHON

Xristos Xristoou saxri89 at gmail.com
Fri May 20 16:24:56 EDT 2016


i want to use python API from the QGIS in my python idle out from QGIS program , but i have some errors if i try to import qgis.core in my idle. i have python 2.7 64 bit (my version) and i install QGIS via OSGeo4W64.

first i try to set two PATHS PYTHONPATH = C:\OSGeo4W64\apps\qgis\pythonPYTHONPATH(because there is the python python) and set PATH=C:\OSGeo4W64\apps\qgis\binPATH(because there is the python modules modules).now if i try to import qgis.core then show me error message no module name siperror in idle

after this error i try to import paths inside the idle via sys.path.extend

import sys
sys.path.extend([r"C:\OSGeo4W64\apps\qgis\python",
     r"C:\OSGeo4W64\apps\qgis\bin",
     r"C:\OSGeo4W64\bin",
     r"C:\OSGeo4W64\apps\qgis\bin",
     r"C:\OSGeo4W64\apps\qgis\python",
     r"C:\OSGeo4W64\apps\Python27",
     r"C:\OSGeo4W64\apps\Python27\Scripts",
     r"C:\OSGeo4W64\apps\Python27\sip",
     r"C:\OSGeo4W64\apps\Python27\sip\Qt",
     r"C:\OSGeo4W64\apps\Python27\sip\QtCore",
     r"C:\OSGeo4W64\apps\Python27\sip\Qwt5",
     r"C:\OSGeo4W64\apps\Python27\sip\QtScriptTools",
     r"C:\OSGeo4W64\apps\Python27\DLLs",
     r"C:\OSGeo4W64\apps\Python27\Lib",
     r"C:\OSGeo4W64\apps\Python27\Lib\site-packages",
     r"C:\OSGeo4W64\apps\Python27\Tools\Scripts",
     r"C:\OSGeo4W64\apps\qgis\plugins",
     r"C:\OSGeo4W64\apps\qgis\python\qsci_apis",
     r"C:\OSGeo4W64\apps\qgis\python\qgis",
     r"C:\OSGeo4W64\apps\qgis\python\qgis\core",
     r"C:\OSGeo4W64\apps\qgis\python\qgis\analysis",
     r"C:\OSGeo4W64\apps\qgis\python\PyQt",
     r"C:\OSGeo4W64\apps\qgis\python\PyQt4",
     r"C:\OSGeo4W64\apps\qgis\python\PyQt4\uic\widget-plugins",
     r"C:\OSGeo4W64\apps\qgis\bin",
     r"C:\Python27",
     r"C:\Python27\Scripts",
     r"C:\OSGeo4W64\apps\qgis\python"])
i use more paths for sure but now show me DLL error load failed error 2

finaly i try other method from this bat file(question). my bat file.

set PYTHONPATH=C:\OSGeo4W64\apps\qgis\python
set PATH=C:\OSGeo4W64\apps\qgis\bin;C:\OSGeo4W64\bin;C:\OSGeo4W64\apps\qgis\bin;C:\OSGeo4W64\apps\qgis\python;C:\OSGeo4W64\apps\Python27;C:\OSGeo4W64\apps\Python27\Scripts;C:\OSGeo4W64\apps\Python27\sip;C:\OSGeo4W64\apps\Python27\sip\Qt;C:\OSGeo4W64\apps\Python27\sip\QtCore;C:\OSGeo4W64\apps\Python27\sip\Qwt5;C:\OSGeo4W64\apps\Python27\sip\QtScriptTools;C:\OSGeo4W64\apps\Python27\DLLs;C:\OSGeo4W64\apps\Python27\Lib;C:\OSGeo4W64\apps\Python27\Lib\site-packages;C:\OSGeo4W64\apps\Python27\Tools\Scripts;C:\OSGeo4W64\apps\qgis\plugins;C:\OSGeo4W64\apps\qgis\python\qsci_apis;C:\OSGeo4W64\apps\qgis\python\qgis;C:\OSGeo4W64\apps\qgis\python\qgis\core;C:\OSGeo4W64\apps\qgis\python\qgis\analysis;C:\OSGeo4W64\apps\qgis\python\PyQt;C:\OSGeo4W64\apps\qgis\python\PyQt4;C:\OSGeo4W64\apps\qgis\python\PyQt4\uic\widget-plugins;C:\OSGeo4W64\apps\qgis\bin;C:\Python27\;C:\Python27\Scripts
if i run this bat file in the OSGeo4w shell work but only in the shell shell image. but not work again in my idle again show me error no module name SIPerror sip why?any idea how to fix that? the problem is the paths sure but i dont know how to fix that.err



More information about the Python-list mailing list