GDBM incompatibility in different python versions?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brokow
    New Member
    • Oct 2006
    • 7

    #1

    GDBM incompatibility in different python versions?

    I have been trying to get the gdbm module in python 2.4 to read a gdbm file from python 1.5.2 and having no luck. I get a file error when I try to open the 1.5.2-created gdbm file.

    Even a very simple gdbm database causes the trouble. E.g. I create a one-entry db in python 1.5.2
    Code:
    Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
    Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
    >>> import gdbm
    >>> db2 = gdbm.open(r'C:\test.gdbm','n')
    >>> db2['key1']='spiffweed'
    >>> db2.close()
    Then when I try to open the file in python 2.4
    Code:
    Python 2.4 (#1, Dec  4 2004, 20:10:33)
    [GCC 3.3.3 (cygwin special)] on cygwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import gdbm
    >>> db = gdbm.open(r"c:\test.gdbm","r")
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    gdbm.error: File read error
    So, I am stuck. Is there some way to tell which version of GDBM is being used in python 1.5.2? The versions I have been playing with in 2.4 are GDBM 1.7.2 and 1.8.3.

    BTW, I have to be able to read the gdbm files created in python 1.5.2 in a more recent version of python - I have no choice in that. Doing everything in the same python is not an option here.

    [If this belongs in the DB section of the board, please feel free to move it. I have only played with gdbm files in python, and I don't see an area for gdbm specifically, so I posted here.]
  • brokow
    New Member
    • Oct 2006
    • 7

    #2
    BTW, I could provide the gdbm file I get when using python 1.5.2 if it would help. It's only 3085 bytes.

    It occurs to me that there may have been some other difference that is causing my incompatibility besides just the gdbm version (like the gdbm module having been compiled to use null-terminated strings or some such, though I don't think that is the issue here).

    The gdbm file I get under python 1.5.2's gdbm is here as test.gdbm. (And, for reference, the one I get when I create one using the same code in newer pythons is here as test2.gdbm .)

    Comment

    Working...