[Qgis-developer] Python ogr driver issue (was ----> (no subject))

ludo ludovic.granjon at wanadoo.fr
Sat Aug 25 03:06:59 PDT 2012


Hi

Yes you are right, I forgot the title I'm sorry

I try your code on monday and I tell you

Thanks

 

Ludovic






> Message du 24/08/12 19:09
> De : "Tim Sutton" 
> A : "ludo" 
> Copie à : qgis-developer at lists.osgeo.org
> Objet : Re: [Qgis-developer] Python ogr driver issue (was ----> (no subject))
> 
> Hi (adding a proper subject line to your messages is always nice)
> 
> On Fri, Aug 24, 2012 at 12:09 PM, ludo wrote:
> > Hi all
> >
> > I try to start the developpement for a custom application with qgis, so I
> > try simple things like add a vector layer but I have some problems. In a
> > python console when I try to do something like that :
> >
> >>>> core.QgsApplication.setPrefixPath('/usr',True)
> >>>> core.QgsApplication.initQgis()
> >>>> l = core.QgsVectorLayer('/home/ludo/data/test.shp', 'test', 'ogr')
> >>>> l.isValid()
> >
> > I always have a False result
> >
> > But if I try in the python console of qgis :
> >
> >>>> l = QgsVectorLayer('/home/ludo/data/test.shp', 'test', 'ogr')
> >>>> l.isValid()
> >
> > The result is True
> >
> > Is someone have an idea ? Are there any other documentation that
> > http://qgis.org/pyqgis-cookbook/
> 
> 
> There is a growing set of python unit tests that you can consult for ideas.
> 
> Providiing the stdout from your console might help us to understand
> where your problem originates. Here is a little sript I often use:
> 
> -----------------------------------------------------------------
> 
> import os
> import sys
> from qgis.core import QgsApplication, QgsProviderRegistry
> 
> myUseDefaultPathFlag = True
> QGISAPP.setPrefixPath('/usr', myUseDefaultPathFlag)
> QGISAPP.initQgis()
> s = QGISAPP.showSettings()
> print s
> r = QgsProviderRegistry.instance()
> if not 'ogr' in r.providerList():
> print 'Could not find OGR provider!'
> else:
> print 'Providers found ok!'
> 
> -----------------------------------------------------------------
> 
> Hope that helps!
> 
> 
> Tim
> >
> > Thanks a lot
> >
> > Ludovic
> > _______________________________________________
> > Qgis-developer mailing list
> > Qgis-developer at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >
> 
> 
> 
> -- 
> Tim Sutton - QGIS Project Steering Committee Member (Release Manager)
> ==============================================
> Please do not email me off-list with technical
> support questions. Using the lists will gain
> more exposure for your issues and the knowledge
> surrounding your issue will be shared with all.
> 
> Visit http://linfiniti.com to find out about:
> * QGIS programming and support services
> * Mapserver and PostGIS based hosting plans
> * FOSS Consulting Services
> Skype: timlinux
> Irc: timlinux on #qgis at freenode.net
> ==============================================
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120825/ebe07313/attachment.html>


More information about the Qgis-developer mailing list