tarsh / pyshp

Automatically exported from code.google.com/p/pyshp
MIT License
0 stars 0 forks source link

ValueError: invalid literal for int() with base 10: '' #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The parcel/point shapefile from http://www.ccmap.us/catalog.asp gives:

>>> sf = shapefile.Reader("CAD_AO_ParcelPoint_0711")
>>> sf.fields
[('DeletionFlag', 'C', 1, 0), ['APN', 'C', 9, 0], ['PARC_PY_ID', 'N', 19, 11], 
['REV_DATE', 'D', 8, 0], ['S_STR_NM', 'C', 30, 0], ['S_STR_SUF', 'C', 4, 0], 
['S_STR_NBR', 'C', 5, 0], ['S_FRAC', 'C', 4, 0], ['S_APT_NBR', 'C', 9, 0], 
['S_CTY_ABBR', 'C', 5, 0], ['S_ZIP', 'C', 5, 0], ['S_ZIP_EXT', 'C', 4, 0]]
>>> shapes = sf.shapes()
>>> len(shapes)
370097
>>> records = sf.records()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "shapefile.py", line 315, in records
    r = self.__record()
  File "shapefile.py", line 286, in __record
    y, m, d = int(value[:4]), int(value[4:6]), int(value[6:8])
ValueError: invalid literal for int() with base 10: ''

Original issue reported on code.google.com by digitalbitstream@gmail.com on 26 Aug 2011 at 8:07

GoogleCodeExporter commented 9 years ago
The error was caused from blank values in Dbf fields.  A fix has been uploaded 
to the repository which checks for blank values and then avoids trying to parse 
them.

Original comment by geospati...@gmail.com on 26 Aug 2011 at 7:42

GoogleCodeExporter commented 9 years ago
Cool. Thanks for the fast response.

Original comment by digitalbitstream@gmail.com on 26 Aug 2011 at 8:04