Re: dbm.open Blind?

Robin Friedrich (friedric@rose.rsoc.rockwell.com)
Wed, 30 Mar 94 07:28:42 CST

> From jack@cwi.nl Wed Mar 30 03:42:55 1994
> To: friedric@rsoc.rockwell.com (Robin Friedrich)
>
>
> Recently, friedric@rose.rsoc.rockwell.com (Robin Friedrich) said:
> > This is really getting on my nerves. I'm dabbling with dbm files for the firs
> > t
> > time(with python that is). I have an existing dbm database and I would like
> > to access it from python. What am I doing wrong?!?!
> > ...
> > -rw-r--r-- 1 friedric 4096 Mar 29 17:14 Notebase.dir
> > -rw-r--r-- 1 friedric 16384 Mar 29 17:14 Notebase.pag
> > ...
> > >>> x = dbm.open('Notebase','r',0644)
> > Traceback (innermost last):
> > File "<stdin>", line 1
> > dbm.error: (2, 'No such file or directory')
>
> The only thing I can imagine is that there has been some error in
> building your dbm module. Even if the files were the wrong format
> (i.e. because they were built with a different, incompatible, version
> of dbm) the open should succeed (who knows what happens later, but the
> open should succeed).
> --
> Jack Jansen | If I can't dance I don't want to be part of
> Jack.Jansen@cwi.nl | your revolution -- Emma Goldman
> uunet!cwi.nl!jack G=Jack;S=Jansen;O=cwi;PRMD=surf;ADMD=400net;C=nl
>
I did rebuild python recently to add the SUIT module from UVA and I threw
in Mike McLay's dbhash module at the same time as well. But I didn't have
any build warnings with the dbm stuff. I hadn't used it before so I don't
know if it used to work or not. If there was a build problem why did the import
work?
I tried to open a new database file and got the following:

>>> import dbm
>>> x = dbm.open('XXX','rw',0644)
>>> len(x)
0
>>>
darwin 5 % ll
total 44
drwxr-xr-x 2 friedric 512 Mar 30 07:15 ./
drwxr-xr-x 7 friedric 1024 Mar 29 17:14 ../
-rw-r--r-- 1 friedric 4096 Mar 29 17:14 Notebase.dir
-rw-r--r-- 1 friedric 16384 Mar 29 17:14 Notebase.pag
-rw-r--r-- 1 friedric 16384 Mar 30 07:15 XXX.db
...
This is getting spooky.