Logged In: YES
user_id=81797
I'm torn as to what should happen here. In the
documentation, it says that in the event that the file
exists, the whichdb module will be used to determine the
type of the database. In the case of an unrecognised
database format, that function returns the empty string, and
anydbm raises that as an exception. On the other hand, the
documentation says that if "n" is passed a new database will
always be created, which in this case it definitely is not.
I'd be reluctant to change anydbm.open(), since the reason
for anydbm to exist is that it determines the database type
of an existing file, and in the case that it doesn't
understand the database type it says so. One could imagine
a "textdb" type being added later where an empty file would
be a valid, empty, textdb file, but a change to anydbm here
could lead to problems in the future.
The real solution, I would propose, is that in the event
that you're trying to create a temporary database, call
mkstemp, then call "anydbm._defaultmod.open" on the
resulting file name, for example. Call the module directly
instead of relying on anydbm.
I'm inclined to close this as Wont Fix, please re-open if
you think the assessment is wrong.
Sean
|