473,396 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

GDBM incompatibility in different python versions?

7
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
Expand|Select|Wrap|Line Numbers
  1. Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
  2. Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
  3. >>> import gdbm
  4. >>> db2 = gdbm.open(r'C:\test.gdbm','n')
  5. >>> db2['key1']='spiffweed'
  6. >>> db2.close()
Then when I try to open the file in python 2.4
Expand|Select|Wrap|Line Numbers
  1. Python 2.4 (#1, Dec  4 2004, 20:10:33)
  2. [GCC 3.3.3 (cygwin special)] on cygwin
  3. Type "help", "copyright", "credits" or "license" for more information.
  4. >>> import gdbm
  5. >>> db = gdbm.open(r"c:\test.gdbm","r")
  6. Traceback (most recent call last):
  7.   File "<stdin>", line 1, in ?
  8. 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.]
Mar 26 '07 #1
1 1761
brokow
7
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 .)
Mar 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Fortepianissimo | last post by:
First off I know I can install the latest python from Fink quite easily and it'll give me everything needed. But I'm trying to distribute my python app to end users who don't really care (or know)...
1
by: Ed | last post by:
I am trying to use a Perl script which requires a Database module other than "dbm" to be the default Mod. So, what the script is checking is import anydbm if (anydbm._defaultmod.__name__ ==...
0
by: Douglas Applegate | last post by:
Hi- I am having a problem with shelve. The problem I think is really with gdbm. I'll write out a file using shelve/gdbm on an amd64 machine and then I'll try to read it in on a i386 machine. The...
2
by: RayOsborn | last post by:
I have some old "shelve" databases created in Python 2.2 that use the old bsddb format, whereas the version of Python 2.4 installed by my web hosting service doesn't have bsddb available at all...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.