Tuesday, 26 June 2018

python - 'NoneType' object has no attribute


I am new to python geospatial programming. i ran the following script and got the corresponding error message


>>> import osgeo
>>> import osgeo.ogr
>>> shapefile = osgeo.ogr.Open("tl_2009_us_state.shp")
>>> numLayers = shapefile.GetLayerCount()

Traceback (most recent call last):

File "", line 1, in
numLayers = shapefile.GetLayerCount() AttributeError: 'NoneType' object has no attribute 'GetLayerCount'


No comments:

Post a Comment