Am I right in thinking this is the cause of the error...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python27\lib\site-packages\dbfpy\dbf.py", line 138, in init
self.header = self.HeaderClass.fromStream(self.stream)
File "c:\python27\lib\site-packages\dbfpy\header.py", line 128, in fromStream
_fld = fields.lookupFor(_data[11]).fromString(_data, _pos)
File "c:\python27\lib\site-packages\dbfpy\fields.py", line 473, in lookupFor
return _fieldsRegistry[typeCode]
KeyError: '0'
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As I remember it helped me to work with this by adding 2 classes as workaround. File 'fields.py':
classDbfVarCharacterFieldDef(DbfFieldDef):"""Definition of the character field."""typeCode="V"defaultValue=""defdecodeValue(self,value):"""Return string object. Return value is a ``value`` argument with stripped right spaces. """returnvalue# .rstrip(" ")defencodeValue(self,value):"""Return raw data string encoded from a ``value``."""returnstr(value)[:self.length].ljust(self.length)classDbfCharacterNameFieldDef(DbfFieldDef):"""Definition of the character field."""typeCode="0"defaultValue=""defdecodeValue(self,value):"""Return string object. Return value is a ``value`` argument with stripped right spaces. """returnvalue.rstrip(" ")defencodeValue(self,value):"""Return raw data string encoded from a ``value``."""returnstr(value)[:self.length].ljust(self.length)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Am I right in thinking this is the cause of the error...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python27\lib\site-packages\dbfpy\dbf.py", line 138, in init
self.header = self.HeaderClass.fromStream(self.stream)
File "c:\python27\lib\site-packages\dbfpy\header.py", line 128, in fromStream
_fld = fields.lookupFor(_data[11]).fromString(_data, _pos)
File "c:\python27\lib\site-packages\dbfpy\fields.py", line 473, in lookupFor
return _fieldsRegistry[typeCode]
KeyError: '0'
As I remember it helped me to work with this by adding 2 classes as workaround. File 'fields.py':
Please, can you provide an example data file?
I cannot, sorry. It was the file of my client.