Subject: [Thuban-list] Opening a dbf

From: mark loyd <[email-masked]>
Date: Mon, 21 Jul 2008 11:35:01 -0700 (PDT)

Hello,
 
I am using Thuban version 1.2.1 win32 and get the following error message when trying to open a dbf. (this dbf is not part of a shapefile but one that i am trying to open so that it may be joined to an attribute table of a shapefile)
 
Traceback (most recent call last):
  File "thuban\buildthuban\out1.pyz/Thuban.UI.mainwindow", line 300, in invoke_command
  File "thuban\buildthuban\out1.pyz/Thuban.UI.command", line 121, in Execute
  File "thuban\buildthuban\out1.pyz/Thuban.UI.mainwindow", line 1075, in call_method
  File "thuban\buildthuban\out1.pyz/Thuban.UI.mainwindow", line 862, in TableOpen
  File "thuban\buildthuban\out1.pyz/Thuban.Model.session", line 279, in OpenTableFile
  File "thuban\buildthuban\out1.pyz/Thuban.Model.table", line 99, in __init__
KeyError: 3
 
Any help would be greatly appreciated.
 
Also, Is there a limit on the size of a dbf that can be opened?
 
Thank you!
 
Mark Loyd

---

From: "Anthony Lenton" <[email-masked]>
Date: Tue, 22 Jul 2008 11:04:45 -0300

Hello Mark,

On Mon, Jul 21, 2008 at 3:35 PM, mark loyd <[email-masked]> wrote:
> I am using Thuban version 1.2.1 win32 and get the following error message
> when trying to open a dbf. (this dbf is not part of a shapefile but one that
> i am trying to open so that it may be joined to an attribute table of a
> shapefile)
>
>
>

The KeyError here seems to be because the DBF you're trying to open
contains boolean columns.  Though the C part of dbflib supports
reading and writing booleans, in the Python wrapper code there's only
support for Ints, Doubles and Strings.
I'm not sure if there's a good reason for not doing bools, but it
seems like it's just something nobody ever got round to implementing.
If nobody else is coding it I'll add it to my ToDo list, so stay tuned! :)

> Also, Is there a limit on the size of a dbf that can be opened?

Afaik only relative to the amount of memory on your machine.  I've
opened dbfs that were several megas large, but nothing really huge.

> Mark Loyd

Cheers,

-- 
Anthony Lenton
Except - The good guys in software development
http://except.com.ar

---

From: Bernhard Reiter <[email-masked]>
Date: Thu, 24 Jul 2008 11:15:08 +0200

On Tuesday 22 July 2008 16:04, Anthony Lenton wrote:
> contains boolean columns. 

Hmm, in this case: If you might use a different tool to change
the boolean columns into something else (deleted them or Integers).
I personally would try with Ooo Calc or KSpread.

> Though the C part of dbflib supports 

> If nobody else is coding it I'll add it to my ToDo list, so stay tuned! :)

Note that the new shapelib code in Brams Unicode branch will probably also
do dbf files better, so new developments should be based on it.
So first making an entry in the tracker would be cool as well. ;)

Do we have a short example dbf?

Bernhard

-- 
Managing Director - Owner: www.intevation.net       (Free Software Company)
Germany Coordinator: fsfeurope.org. Coordinator: www.Kolab-Konsortium.com.
Intevation GmbH, Osnabrück, DE; Amtsgericht Osnabrück, HRB 18998
Geschäftsführer Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner