i want to work with dbf Files on Python 3.7 with dbfread Module, it works with a small dbf
from dbfread import DBF from struct import * table = DBF('usuarios.dbf', load=True) for item in table: print (item) Output:
OrderedDict([('NUMUSER', ' 0'), ('NOMUSER', 'Rosy'), ('PASSWORD', ''), ('NIVEL', 'SUPER'), ('VALIDAR', 'P?@qMwá¿|Ew}"Q-JW0Q0:iw^'), ('EMAIL', '[email protected]|'), ('MAILTIPO', 1), ('MAILFIRMA', None), ('MAILSMTP', 'Ghf2U*wT3Ik?D#>W0@+9@," ¡.deZ+%¿i?GL0oBrO+éZ=KwXw{E(LXIv#ñOññW+t"AruéñAm\\O>YB$iTNv*\'Ñé2).*qv#88XZ5k%KK%R}~¡oOgiTó\'=#'), ('HUELLA1', None), ('HUELLA2', None), ('METODO', 0), ('ACTIVO', True)]) [Finished in 0.2s] but when i try with a large dbf it shows error
from dbfread import DBF from struct import * table = DBF('docum.dbf', load=True) for item in table: print (item) Output2:
Traceback (most recent call last): File "C:\Users\user\rdbfs.py", line 4, in <module> table = DBF('docum.dbf', load=True) File "C:\Python3\lib\site-packages\dbfread\dbf.py", line 121, in __init__ self._read_header(infile) File "C:\Python3\lib\site-packages\dbfread\dbf.py", line 206, in _read_header self.header = DBFHeader.read(infile) File "C:\Python3\lib\site-packages\dbfread\struct_parser.py", line 41, in read return self.unpack(file.read(self.struct.size)) File "C:\Python3\lib\site-packages\dbfread\struct_parser.py", line 36, in unpack items = zip(self.names, self.struct.unpack(data)) struct.error: unpack requires a buffer of 32 bytes [Finished in 0.2s with exit code 1] i don't know about pack or unpack data in python, can you help me guys? or give guideance. Thanks!