Menu

#19 Error when trying to access dbf file entries

-
closed
nobody
None
9
2015-08-09
2015-06-04
Thomas Frei
No

Hi

I'm trying to use dbfpy to change the entries of an existing dbf file (see attachment). For this I'd like to read out the columns of the file, edit them and write them back into the file. Unfortunately, when I try to access the entries I always get an error: "ValueError: invalid literal for int() with base 10: '****' "

I'm doing the following:
from dbfpy import dbf db=dbf.Dbf("Belgium_Pipelines.dbf", readOnly=False, new=False)
Line_Name=db[1]
Flow_Direction=db[5]

Why isn't that working? I also tried to set up an iterator with: for rec in db, but I get the same error.

Thank you for your help

1 Attachments

Related

Bugs: #19

Discussion

  • Aleksandr Smyshliaev

    That is DBF notion of Numeric Overflow. A value that was put in that field is bigger than field width would allow.

    You may pass ignoreErrors=True to your Dbf() constructor, and then you should get Dbf.INVALID_VALUE instead of exception.

     
    • Thomas Frei

      Thomas Frei - 2015-06-05

      Hi Alexander

      Thank you for your answer. So what do I have to change to make it work? I don't understand why I get this error when calling the rows... I mean I am not writig anything in the fields yet at this part of de code. I just try to iterate over them

      -------- Ursprüngliche Nachricht --------
      Von: alexander smishlajev a1s@users.sf.net
      Datum: 05.06.2015 05:29 (GMT+01:00)
      An: "[dbfpy:bugs]" 19@bugs.dbfpy.p.re.sf.net
      Betreff: [dbfpy:bugs] #19 Error when trying to access dbf file entries

      That is DBF notion of Numeric Overflow. A value that was put in that field is bigger than field width would allow.

      You may pass ignoreErrors=True to your Dbf() constructor, and then you should get Dbf.INVALID_VALUE instead of exception.


      [bugs:#19]http://sourceforge.net/p/dbfpy/bugs/19 Error when trying to access dbf file entries

      Status: open
      Group: -
      Created: Thu Jun 04, 2015 06:47 PM UTC by Thomas Frei
      Last Updated: Thu Jun 04, 2015 06:47 PM UTC
      Owner: nobody

      Hi

      I'm trying to use dbfpy to change the entries of an existing dbf file (see attachment). For this I'd like to read out the columns of the file, edit them and write them back into the file. Unfortunately, when I try to access the entries I always get an error: "ValueError: invalid literal for int() with base 10: '****' "

      I'm doing the following:
      from dbfpy import dbf db=dbf.Dbf("Belgium_Pipelines.dbf", readOnly=False, new=False)
      Line_Name=db[1]
      Flow_Direction=db[5]

      Why isn't that working? I also tried to set up an iterator with: for rec in db, but I get the same error.

      Thank you for your help


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/dbfpy/bugs/19/https://sourceforge.net/p/dbfpy/bugs/19

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/https://sourceforge.net/auth/subscriptions

       

      Related

      Bugs: #19

  • Aleksandr Smyshliaev

    • status: open --> pending
     
  • Thomas Frei

    Thomas Frei - 2015-06-05

    Actually it was enough to just add ignoreError to the Dbf construction. Thank you!

    Solution:
    from dbfpy import dbf
    db=dbf.Dbf("Belgium_Pipelines.dbf", ignoreErrors=True)

     
  • Aleksandr Smyshliaev

    • status: pending --> closed
     

Log in to post a comment.