[Qgis-developer] Use qgis libraries in python scripts
Minja
msiljegovic at gmail.com
Fri Jul 16 07:27:40 EDT 2010
Thanks Martin,
In mean time I switched to python 2.5 and I succeed to include qgis
libraries.
I wanted to be independent from OSGeo4 because when I wanted to use pyDev
for debugging code, I couldnt use python.exe interpreter from OSGeo4
installation folder. I got some strange errors when I wante to reference to
python.exe.
Also another problem was that I used unstable version of OSGeo4, so maybe
that caused also problems. Just thinking...
Anyway, thx a lot for answer
Cheers
Minja
On Fri, Jul 16, 2010 at 1:03 PM, Martin Dobias <wonder.sk at gmail.com> wrote:
> Hi Minja
>
> On Fri, Jul 9, 2010 at 10:19 AM, Minja <msiljegovic at gmail.com> wrote:
> > Im trying to create standalone python application that will use PyQT4
> > libraries and QGIS libriaries. I installed first python 3.1 and tested it
> in
> > console and Eclipse PyDev enviroment. It worked fine....then I installed
> > PyQt GPL v4.7.3 for Python 3.1, tested import of those libraries and
> > everything worked fine on both console and eclipse enviroment.
> >
> > My next step was to try to use qgis libraries and I followed tutorial
> from
> > this site http://mapserver.sk/~wonder/qgis/html/intro.html to configure
> > enviroment variables for using PyQGIS in my standalone application. But
> when
> > I test "from qgis.core import *" Im getting error message "from
> qgis.core
> > import * ImportError: DLL load failed: The specified procedure could not
> be
> > found" all the time.
>
> Python binding shipped with QGIS (both OSGeo4W and standalone) are
> compiled against Python 2.x releases, so don't expect that it will
> work with Python 3. Please use Python 2 and I _strongly_ recommend you
> to use Python from OSGeo4W installation to prevent further troubles.
>
> You _may_ have some success with Python 3 if you compiled QGIS with
> bindings from source code, though the procedure might require some
> tweaking and so far I am not aware of any effort in order to compile
> and run QGIS with Python 3. At some point of time in future, QGIS will
> use Python 3 by default, but nowadays everyone still uses Python 2.x.
>
>
>
> > Here is how mine enviroment variables are set
> > PYTHONPATH:
> > C:\Python31\Lib\site-packages;C:\OSGeo4W\apps\qgis-unstable\python;
> > PATH:
> C:\OSGeo4W\apps\qgis-unstable;C:\Python31\Lib\site-packages\PyQt4\bin;
> > I also tried with options to set following paths in
> > PATH C:\OSGeo4W\apps\qgis-unstable\bin;C:\OSGeo4W\apps\qgis-unstable\lib;
> > I read a lot about this on internet and forums, I also saw comments that
> I
> > should use python and PyQt installation that comes with QGIS(version
> 1.4.0)(
> > I tried that running OSGeo4W shell and it worked), but I think it would
> be
> > better to dont be dependent directly to OSGeo installation...I would like
> > only to use QGIS librarires same as it is happenning with PyQT4.
>
> I don't understand why you try to be independent from the OSGeo4W
> installation. Having all the libraries in place (and working well) is
> a huge advantage of OSGeo4W. If you do that to ensure that you don't
> have to carry the whole OSGeo4W installation with your custom
> application, then don't worry. You can simply copy only necessary
> components (Python, SIP, PyQt4, QGIS and its dependencies) from it,
> just like you would do it otherwise anyway.
>
> Regards
> Martin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20100716/28b60aff/attachment.html
More information about the Qgis-developer
mailing list