I'm trying to use NetworkX to read a Shapefile and use the function write_shp() to generate the Shapefiles that will contain the nodes and edges (following this example - https://networkx.github.io/documentation/latest/reference/readwrite.nx_shp.html), but when I try to run the code it gives me the following error:
Traceback (most recent call last): File
"C:/Users/Felipe/PycharmProjects/untitled/asdf.py", line 4, in
nx.write_shp(redVial, "shapefiles") File "C:\Python34\lib\site-packages\networkx\readwrite\nx_shp.py", line
192, in write_shp
for key, data in e.iteritems(): AttributeError: 'dict' object has no attribute 'iteritems'
As you are in python3 , use
dict.items() instead of
iteritems() was removed in python3, so you can't use this method anymore.
Take a look at Python Wiki (Link)
In Built-in Changes part, it is stated that
Removed dict.iteritems(), dict.iterkeys(), and dict.itervalues().
Instead: use dict.items(), dict.keys(), and dict.values() respectively.