I am trying to write a standalone Python script in windows 7 that uses qgis.core and various other qgis libraries.
I have found an old question on this subject at Writing standalone Python scripts using PyQGIS? and was following its advice, by using the guide at http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html#python-applications
The code suggested there is:
set PYTHONPATH=c:\qgispath\python
followed by:
set PATH=C:\qgispath;%PATH%
I found that IDLE did not like the "set at the beggining, so my code looks like this:
PYTHONPATH="C:\OSGeo4W64\apps\qgis\python"
PATH="C:\OSGeo4W64\apps\qgis\python\qgis\core;%PATH%"
import qgis.core
and I get:
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
import qgis.core
ImportError: No module named qgis.core
I have tried every variant of the paths I can think of including removing the ;%PATH%" at the end (that looks a bit superfluous) but have not been able to find any more information.
Does anyone have any idea where I might be going wrong?
After seeing Luigi Pirelli's comment I have now tried:
>>> PYTHONPATH="C:/OSGEO4~1/apps/qgis/./python\qgis"
>>> import qgis.core
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import qgis.core
ImportError: No module named qgis.core
>>> PATH="C:\OSGeo4W64\apps\qgis\python\qgis\core;%PATH%"
>>> import qgis.core
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import qgis.core
ImportError: No module named qgis.core
>>> PATH="C:/OSGEO4~1/apps/qgis/./python\qgis\core;%PATH%"
>>> import qgis.core
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
import qgis.core
ImportError: No module named qgis.core
>>>