Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

This is my first question so please go easy. I am trying to develop a Plugin for QGIS. I made my plugin using the "plugin builder", then compiled the .qrc and .ui files with PySide-rcc.exe and PySide.uic.py respectively. This all seems satisfactory.

However, my first problem arises when the plugin loads as the QGIS and Python (PySide) libraries are not in the same place.

ImportError: No module named PySide

I resolved this by adding a reference to the PySide path at the start of the compiled .ui module:

Import sys
Sys.path.append("C:\\Python27\\Lib\\site-packages")

Unfortunately when I run it again I get the critical error:

ImportError: DLL load failed: %1 is not a valid Win32 application.

Google searches are leading me to believe that this is caused by an incompatibility between 32bit and 64bit modules, however, I cannot easily download different versions as they are supplied under my companies IS policy.

This seems to apply to all the QGIS modules as i can not access any modules even from the python console:

>>> import sys
>>> sys.path.append("C:/Program Files (x86)/Quantum GIS Lisboa/apps/qgis/python")
>>> for path in sys.path:
print path

C:\Windows\system32
C:\Python27\Scripts
D:\HRW\VET\HrwPyLibs
D:\HRW\VET\HrwPyLibs\Xdmf
D:\HRW\VET\HrwPyLibs\Converters
C:\Python27\python27.zip
C:\Python27\DLLs
C:\Python27\lib
C:\Python27\lib\plat-win
C:\Python27\lib\lib-tk
C:\Python27
C:\Python27\lib\site-packages
C:\Python27\lib\site-packages\PIL
C:\Python27\lib\site-packages\win32
C:\Python27\lib\site-packages\win32\lib
C:\Python27\lib\site-packages\Pythonwin
C:/Program Files (x86)/Quantum GIS Lisboa/apps/qgis/python
>>> from qgis.core import QgsFeatures

Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
from qgis.core import QgsFeatures
ImportError: DLL load failed: %1 is not a valid Win32 application.

Has anyone else experienced this problem or is there an obvious issue that i have not noticed?

Thanks,

Chris

Running: Windows 7 (64bit), Python 2.7.2 (64bit), QGIS 1.8.0 (???)

share|improve this question
    
actually this i have noticed that this happens in the console as described above, which is 64bit. But that when it happens in QGIS the python being used is 32bit - presumably QGIS is also 32bit. –  Christopher Lloyd Brett Jul 24 '13 at 13:35
    
Urgh, Ok, i now see that my company have issued me with 64bit Python and modules and 32bit QGIS with 32bit Python and modules. Seemingly there is a compatibility between the modules available to each as running the from qgis.core import QgsFeatures in the QGIS python console yeilds no problems - however, i still need to build my ui and qrc files. Time to lobby the IT department for 32bit PySide installed into the QGIS module directory. –  Christopher Lloyd Brett Jul 24 '13 at 13:46
    
You shouldn't be using pyside or your own Python install. QGIS comes with it's own Python27 install and PyQt4 which has pyucc4 –  Nathan W Jul 24 '13 at 21:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.