Author: johannes
Date: 2005-05-04 10:10:34 -0500 (Wed, 04 May 2005)
New Revision: 7525
Modified:
trunk/gnue-common/src/utils/dbf.py
Log:
Clipper seems to have a NULL character as header-terminator
Modified: trunk/gnue-common/src/utils/dbf.py
===================================================================
--- trunk/gnue-common/src/utils/dbf.py 2005-05-04 14:45:15 UTC (rev 7524)
+++ trunk/gnue-common/src/utils/dbf.py 2005-05-04 15:10:34 UTC (rev 7525)
@@ -125,7 +125,7 @@
reserved = self.__file.read (2)
self.__file.seek (self.headerLen - 1, 0)
- if self.__file.read (1) != '\x0d':
+ if not self.__file.read (1) in ['\x00', '\x0d']:
raise InvalidFormatError, "Missing terminator flag"
self.dataOffset = self.headerLen
@@ -267,7 +267,7 @@
if __name__ == '__main__':
- dbfile = dbf ('foobar.dbf')
+ dbfile = dbf ('/home/johannes/dat_cli.dbf')
print "STATs:"
print " Signature:", dbfile.signature
@@ -280,6 +280,7 @@
for fdef in dbfile.fields:
print " ", fdef
+ raw_input ()
print
print "ROWS:"
print
_______________________________________________
Commit-gnue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/commit-gnue