Skip to content

Commit 6670125

Browse files
committed
Raise shapefile file size limit, and add Reader.close() test
1 parent 4fa6355 commit 6670125

15 files changed

+20
-1
lines changed

shapefile.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,10 @@ def __shpRecord(self, s):
18001800
def __shxRecord(self, offset, length):
18011801
"""Writes the shx records."""
18021802
f = self.__getFileObj(self.shx)
1803-
f.write(pack(">i", offset // 2))
1803+
try:
1804+
f.write(pack(">i", offset // 2))
1805+
except error:
1806+
raise ShapefileException('The .shp file has reached its file size limit > 4294967294 bytes (4.29 GB). To fix this, break up your file into multiple smaller ones.')
18041807
f.write(pack(">i", length))
18051808

18061809
def record(self, *recordList, **recordDict):

shapefiles/test/balancing.dbf

0 Bytes
Binary file not shown.

shapefiles/test/contextwriter.dbf

0 Bytes
Binary file not shown.

shapefiles/test/dtype.dbf

0 Bytes
Binary file not shown.

shapefiles/test/line.dbf

0 Bytes
Binary file not shown.

shapefiles/test/linem.dbf

0 Bytes
Binary file not shown.

shapefiles/test/linez.dbf

0 Bytes
Binary file not shown.

shapefiles/test/multipatch.dbf

0 Bytes
Binary file not shown.

shapefiles/test/multipoint.dbf

0 Bytes
Binary file not shown.

shapefiles/test/onlydbf.dbf

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)