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