<p>Hi<br /><br />Ok so I try your script Tim and I obtain this :<br /><br />Application state:<br />Prefix:        /usr<br />Plugin Path:        /usr/lib/qgis/plugins<br />Package Data Path:    /usr/share/qgis<br />Active Theme Name:   <br />Active Theme Path:    :/images/themes//<br />Default Theme Path:    :/images/themes/default/<br />SVG Search Paths:    /usr/share/qgis/svg/<br />User DB Path:    /usr/share/qgis/resources/qgis.db<br /><br />Could not find OGR provider!<br /><br />When I do<br />for i in r.providerList():<br />    print i<br /><br />I have<br /><br />delimitedtext<br />gdal<br />gpx<br /><br />But the same in the python console of QGIS :<br /><br />\etat de l'application :<br />Prefixe:            /usr<br />Chemin de l'extension :        /usr/lib/qgis/plugins<br />Chemin vers les donnees :    /usr/share/qgis<br />Nom du theme actif :        default<br />Chemin vers le theme actif :    :/images/themes/default/<br />Chemin vers le theme par defaut :    :/images/themes/default/<br />Chemin SVG:        /usr/share/qgis/svg/<br />        /home/ludo/.qgis//svg/<br />Chemin vers la base utilisateur :    /usr/share/qgis/resources/qgis.db</p>
<p> </p>
<p>and</p>
<p> </p>
<p>WFS</p>
<p style="margin: 0px; text-indent: 0px;">gdal</p>
<p style="margin: 0px; text-indent: 0px;">gpx</p>
<p style="margin: 0px; text-indent: 0px;">grass</p>
<p style="margin: 0px; text-indent: 0px;">grassraster</p>
<p style="margin: 0px; text-indent: 0px;">memory</p>
<p style="margin: 0px; text-indent: 0px;">mssql</p>
<p style="margin: 0px; text-indent: 0px;">ogr</p>
<p style="margin: 0px; text-indent: 0px;">osm</p>
<p style="margin: 0px; text-indent: 0px;">postgres</p>
<p style="margin: 0px; text-indent: 0px;">spatialite</p>
<p style="margin: 0px; text-indent: 0px;">wms</p>
<p><br /> Do you know where is the problem ?</p>
<p> </p>
<p>Thanks</p>
<p> </p>
<p>Ludovic<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>