Shelve problem: why so big?
taw_usenet at yahoo.com
Fri Nov 9 03:15:45 CET 2001
geert at cs.uu.nl (Geert-Jan Giezeman) wrote in message news:<9se1du$6eg$1 at samos.cs.uu.nl>...
> >"Oleg Broytmann" <phd at phd.pp.ru> wrote in message
> >news:mailman.1005218719.27461.python-list at python.org...
> >> On Thu, Nov 08, 2001 at 11:00:52AM +0000, Geert-Jan Giezeman wrote:
> >> > I am trying to create a shelve from a table of 1100 by 1100 floating
> >> > point numbers, which I want to store as 1100 lists of length 1100,
> >> > indexed by a key. Unfortunately, I get an error when I try to create
> >> > this:
> >> > bsddb.error; (22, Invalid argument)
> >> http://www.python.org/cgi-bin/faqw.py?req=show&file=faq04.099.htp
> This FAQ advises to move to a newer version of the Berkeley DB library.
> How do I know which version I use? How do I replace it with a newer?
> (I installed the standard Python 2.1 distribution for Windows).
> In <dfvG7.28$eZi.174679040 at news.telia.no> "Thomas Weholt" <thomas at gatsoft.no> writes:
> >I've experienced this problem if I don't close the db-connection after using
> >it. Be sure that you call close before ending the script/program.
> I did that, so that was not the cause of the trouble.
I had some difficulties with differing versions of bsddbm due to
apache (and therefore mod_python) being linked to a different version
than the normal interpreter. I avoided the problem by forcing the use
of a different dbm, namely gdbm:
# ___db stuff___
import anydbm, gdbm, dbhash
#anydbm._defaultmod = dbhash #i.e. bsdbm
anydbm._defaultmod = gdbm
Solved the problem. So far, no performance issues. Try it out if all
More information about the Python-list