[Tutor] RE: Shelve Help!
Mon, 21 Aug 2000 09:24:16 +0100
Thank you for replying to my SOS! I have managed to narrow the
problem down somewhat...there is no dbm module nor any other type when I
check. So I went to reinstall python to include these modules. I altered the
Modules/Setup file to include them. ran make clean and then ./configure and
then make. However when I ran make I got an error saying that I do not have
the following file: ndbm.h. I ran a search for this file and located it in
the following places:
how do I tell make that the ndbm.h is present at these locations?
> Dear all,
> I have the following error traceback from this line of code:
> code: db = shelve.open('DataBase', 'w')
First, I don't think you want the 'w' as part of the open. As far as I know
shelves are opened read/write with no additional parameter accepted.
> File "/usr/local/lib/python1.6/anydbm.py", line
> 83, in open
> raise error, "db type could not be determined"
> anydbm.error: db type could not be determined
> I am afraid I have no idea why I am getting this error, the
> DataBase file
> exists in the same directory as the program is ran from.
Usually when this happens to me it means I didn't close the shelve correctly
the last time I used it. On the other hand it could be related to the above
inclusion of a 'w'.
I've never found a way to recover a shelve if it is corrupted like this.
Its one of my frustrations with shelves. On the other hand, if you get your
program fully debugged it never seems to happen. One of the ways to work
through the debug process might be to make a backup of the shelve every time
you get ready to open it. That way, if it doesn't get closed you have
something to revert to.
> Any help as always is appreciated.
> Thank you,
Hope this wasn't off base.