Hello

I'm trying to develop with ogr in python. I'm on ubuntu 10.4 and I use gdal 1.7 When I try to get back a layer object from a function, I have the following message when I do python monscript.py :
"Erreur de segmentation"

This is my code :

-----------------------
# import modules
from osgeo import ogr

def openShapeLine(shapefile):
    #Ouverture du shapefile avec ogr
    driver = ogr.GetDriverByName("ESRI Shapefile")
    datasource = driver.Open(shapefile)
    layer = datasource.GetLayer()
    return (layer)

couche = openShapeLine('/data/axe.shp')

print couche.GetName()
------------------------

If I do a "print layer.GetName()" inside the openShapeLine function, there's no problem ...

Have you any idea ?

Thanks all

<<attachment: ludovic_granjon.vcf>>

_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to