Hey everyone.
I'm running pyshp 1.2.12 (downloaded today from PyPI) within Python 3.6.4 (and IPython 6.2.1.).
Applying len() to a shapefile trows a TypeError as in the example below,
import shapefile
sf = shapefile.Reader("shp/shpfile.shp")
print(len(sf))
TypeError: object of type 'Reader' has no len()
Also tried loading the shapefile as a Python file descriptor as,
import shapefile
shpfile = open("shp/shpfile.shp","rb")
sf = shapefile.Reader(shp=shpfile)
print(len(sf))
TypeError: object of type 'Reader' has no len()
It seems that the method __len__(shapefile.Reader) wasn't implemented in version 1.2.12 (the one on PyPI). Cloned this repository and the the master branch allowed me to use len(sf)
Hey everyone. I'm running pyshp 1.2.12 (downloaded today from PyPI) within Python 3.6.4 (and IPython 6.2.1.). Applying
len()
to a shapefile trows aTypeError
as in the example below,Also tried loading the shapefile as a Python file descriptor as,
Did I do something wrong?