I am new to manpnik, facing similar problem. mapnik throws runtime error message every time I try to compile a sample code from python geospatial dev book. here's the root of the problem.
datasource = mapnik.Shapefile(file="world_borders.shp")
polygonLayer = mapnik.Layer("Polygons")
polygonLayer.datasource = datasource
polygonLayer.styles.append("polygonStyle")
error message
Traceback (most recent call last):
File "createExampleMap.py", line 45, in <module>
datasource = mapnik.Shapefile(file="world_borders.shp")
File "C:\Python27\lib\site-packages\mapnik\__init__.py", line 341, in Shapefile
return CreateDatasource(keywords)
RuntimeError: Could not create datasource for type: 'shape'
I'd appreciate help from anyone thanks
I had this error message, too. For me it was caused by my moving the
/site-packages/mapnik
dir out of the Mapnik tree.Assuming you are on Windows, you might want to check your paths are sane:
start a command prompt in your demo/python folder and type PATH
check that your lib folder is in the path
start python from the same dir and say
this should output your lib folder, e.g.
'c:\\mapnik-v2.2.0\\lib'
I placed Mapnik's
site-packages
in my Python's Lib dir, which screwed upmapnik.paths
.