Search code examples
pythondbf

How to solve timetuple error on insert record in dbf


I need insert a new record on dbf table:

table.append(('37', '111111', '0', '0', '', '15370', '19/08/14 04:50'))

But i'm getting AttributeError: 'str' object has no attribute 'timetuple' on python.

Table structure: https://i.sstatic.net/Fsb4k.jpg

I am using the DBF library

Any idea?


Solution

  • The data in the tuple should match what the dbf is expecting. According to your graphic:

    CODIGO N(3,0)
    PRODUTO C(6)
    VALOR N(14,4)
    DESC_MAX N(5,2)
    PREVISAO D
    BASE_PERC N(6,2)
    CRC N(6,0)
    DT_ACTUALIZ ?
    

    So you should be passing something like (just using the types):

    ((int, unicode, float, float, date, float, int, ?))
    

    That ? is because I can't see the type of DT_ATUALIZ in the graphic.