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.

I am developing a QGIS plugin and need to create a table view in my GUI that I have been designing with QT Designer. I have PyQT4 installed but I have noticed that I have 2 Python directories. I have one main install on my C: drive and one in my Quantum GIS directory. Both of these Python folders have PyQT4 installed, but the contents of the folders are different. The main issue that I am having is that while the main install of Python has everythign I need to connect to a postgres databased, the Quantum GIS install of PyQT4 has the QSql module but not the drivers to connect to the database! I don't know why this is or how I can get a complete install of PyQT4 in the QGIS version of Python? Can anyone help?

Cheers,

Roman

share|improve this question

1 Answer 1

your plugin uses the directory inside the qgis folder, so you should install the package for connecting to the db in that directory, for default when you install a python package it is installed in the system's python directory, then qgis can not find it, there are three solutions to that: 1) you change the register key in your system, open regedit and find the key for the root of python follow the tree HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore and change the directory to the one in qgis, now on every thing you install for python will point to that directory 2)you copy the directory of the package you need in the directory dist-packages inside the python's directory in qgis 3) you switch to Ubuntu and you are cool, I had your same problem only winth Win, in Ubuntu I found the development for qgis much easyer.

share|improve this answer
    
Cool, thanks for these tips. I started by trying your first point but the weird thing is, Python is not present in my registry, or not at least following the path you specified. I searched through the various registries but couldn't find it at all (but I managed to find QGIS and Postgres). As for the second point, I tried that but then get an error trying to load up QGIS telling me that it can't load Python so it won't be available for use. As for option 3, ahhhh. It's like starting from the beginning again... –  Roman Trubka Apr 20 '12 at 2:07

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.