Skip to content

Commit 768a535

Browse files
authored
Revert back to original records() method
Fixes issue introduced in PR #62, see issue #66. Previously tried fixing it in PR #67, but reverting to original was better.
1 parent af24202 commit 768a535

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

shapefile.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -549,11 +549,13 @@ def records(self):
549549
"""Returns all records in a dbf file."""
550550
if not self.numRecords:
551551
self.__dbfHeader()
552+
records = []
552553
f = self.__getFileObj(self.dbf)
553554
f.seek(self.__dbfHeaderLength())
554-
flat = unpack(self.__recStruct.format * self.numRecords, f.read(self.__recStruct.size * self.numRecords))
555-
rowlen = len(self.fields) - 1
556-
records = list(izip(*(iter(flat),) * rowlen))
555+
for i in range(self.numRecords):
556+
r = self.__record()
557+
if r:
558+
records.append(r)
557559
return records
558560

559561
def iterRecords(self):

0 commit comments

Comments
 (0)