[Tutor] Unpack requires a string argument of length 8
Susana Iraiis Delgado Rodriguez
susana.delgado_s at utzmg.edu.mx
Mon May 2 21:36:24 CEST 2011
I'm working on getting information that comes from a dbf file (database),
this dbf file is related to another file in the system, a shapefile. My code
is trying to get all the dbf name records, but when the systen gets an empty
file, my code fails:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "get_dbf.py", line 32, in <module>
dbf = Dbf(d,new=False, readOnly=True)
File "C:\Python26\lib\site-packages\dbf.py", line 135, in __init_
self.header = self.HeaderClass.fromStream(self.stream)
File "C:\Python26\lib\site-packages\header.py", line 109, in from
(_cnt, _hdrLen, _recLen) = struct.unpack("<I2H", _data[4:12])
struct.error: unpack requires a string argument of length 8
>>>
How can I fix it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110502/713265ee/attachment.html>
More information about the Tutor
mailing list