[Qgis-user] pyqgis vector layer with an accented path

Alexandre Busquets abusquets at gmail.com
Tue Mar 3 00:59:22 PST 2015


Thanks for your help.

I post here my solution for everyone:

from __future__ import unicode_literals

,...

for fn in os.listdir(cad_dir):
    fitxer = fn.decode('utf-8')
    if fitxer.endswith('.dxf'):
        vlayer = QgsVectorLayer(fitxer, 'layer_test', 'ogr')
        ,...


2015-03-03 8:43 GMT+01:00 Jakob Lanstorp <jlanstorp at gmail.com>:

> You can use a u-prefix indicating unicode.
>
> f = u"/home/abusquets/aviĆ³/dades.shp"
> vlayer = QgsVectorLayer(f, "layer_name_you_like", "ogr")
> print vlayer.isValid()
>
> Jakob
>
>
>
> -----
> Jakob Lanstorp
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/pyqgis-vector-layer-with-an-accented-path-tp5190931p5191089.html
> Sent from the Quantum GIS - User mailing list archive at Nabble.com.
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150303/39b6c996/attachment.html>


More information about the Qgis-user mailing list