I want to use QGIS and work with Python out of the console, but I'm having troubles letting the system recognize the paths of some DLLs. Since I couldn't find a good answer on the web, I wonder if I did something wrong. I'm working with Windows 7 64 bit version, using Python 2.7 and QGIS 1.8. In the system environment, I've created and pointed the variable PYTHONPATH to the python directory (which in my case is "C:\Quantum_GIS_Lisboa\apps\qgis\python"). Then I've modified the "Path" variable adding the address where "qgis_core" and "qgis_gui" are found (in my case "C:\Quantum_GIS_Lisboa\apps\qgis\bin"). The instructions I've followed are those of the "PyQGIS Developer Cookbook" ("http://www.qgis.org/pyqgis-cookbook"). It seems the problem relies in recognizing the DLLs, which are in the folder I've pointed to for the variable "Path". Here is the error I have in the Shell when I try to import the module "qgis.core":
Traceback (most recent call last):
File "", line 1, in
import qgis.core
ImportError: DLL load failed: Impossibile trovare il modulo specificato.
Moreover, if I import the sys module and print the path to see what's there, I'm not finding what I expect:
>>> import sys
>>> print sys.path
['C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\ArcGIS\\Python 2.7', 'C:\\Python27\\ArcGIS10.1\\Lib\\idlelib', 'C:\\Quantum_GIS_Lisboa\\apps\\qgis\\python', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\ArcGIS10.1\\DLLs', 'C:\\Python27\\ArcGIS10.1\\lib', 'C:\\Python27\\ArcGIS10.1\\lib\\plat-win', 'C:\\Python27\\ArcGIS10.1\\lib\\lib-tk', 'C:\\Python27\\ArcGIS10.1', 'C:\\Python27\\ArcGIS10.1\\lib\\site-packages', 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\\bin', 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\\arcpy', 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\\ArcToolbox\\Scripts', 'C:\\Python27\\ArcGIS10.1\\lib\\site-packages\\win32', 'C:\\Python27\\ArcGIS10.1\\lib\\site-packages\\win32\\lib', 'C:\\Python27\\ArcGIS10.1\\lib\\site-packages\\Pythonwin']
Hope someone could help me solving this, I'd be really thankful!
I've just tried to copy and paste the whole content of Python27 folder within the main "Quantum GIS Lisboa" folder in the Python27 main folder in my hard drive C, since I saw ArcGIS and Python were working fine like that. Then I tried to launch the IDLE found in "lib/idlelib" ("idle.pyw") from the new folder but this didn't solve the problem. Everything seems to point to the right folders in the system environment. Here is the print of the sys.path after the "reverse" trick:
['C:\\Quantum_GIS_Lisboa\\apps\\qgis\\bin', 'C:\\Quantum_GIS_Lisboa\\apps\\qgis\\python', 'C:\\Python27\\ArcGIS10.1\\lib\\site-packages\\Pythonwin', 'C:\\Python27\\ArcGIS10.1\\lib\\site-packages\\win32\\lib',
'C:\\Python27\\ArcGIS10.1\\lib\\site-packages\\win32', 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\\ArcToolbox\\Scripts', 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\\arcpy', 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\\bin', 'C:\\Python27\\ArcGIS10.1\\lib\\site-packages', 'C:\\Python27\\ArcGIS10.1',
'C:\\Python27\\ArcGIS10.1\\lib\\lib-tk', 'C:\\Python27\\ArcGIS10.1\\lib\\plat-win', 'C:\\Python27\\ArcGIS10.1\\lib', 'C:\\Python27\\ArcGIS10.1\\DLLs', 'C:\\Windows\\system32\\python27.zip', 'C:\\Quantum_GIS_Lisboa\\apps\\qgis\\bin', 'C:\\Quantum_GIS_Lisboa\\apps\\qgis\\python', 'C:\\Python27\\ArcGIS10.1\\Lib\\idlelib', 'C:\\Users\\Umberto\\Desktop']
Traceback (most recent call last):
File "C:\Users\Umberto\Desktop\set_qgis_01.py", line 5, in
import qgis.core
ImportError: DLL load failed: Impossibile trovare il modulo specificato.
Am I suppose to point to the Quantum GIS main folder as well as it contains a folder named "lib"?
No comments:
Post a Comment