anydbm bug ?
Andrew MacIntyre
andymac at bullseye.apana.org.au
Thu Dec 4 17:00:46 EST 2003
On Thu, 4 Dec 2003, Gary Richardson wrote:
> According to the Python Library Reference invoking anydbm.open() with flag
> value 'n' should always create a new empty database. However, the following
> code produces an error. I stumbled upon this while writing some test code.
> Opening and closing the file before invoking anydbm.open() was an attempt to
> delete the results of a previous test. Does this indicate a bug in anydbm?
>
> import anydbm
> filename = r'C:\My Documents\Python\misc\testdb.tmp'
> f = open(filename, 'w')
> f.close()
> file = anydbm.open(filename, 'n')
I don't think there's a bug in anydbm, though the docs perhaps should make
clear that you should make sure any db files are removed before attempting
to create a new db.
truncation is a poor way to attempt to get rid of anything that might
exist - if it exists, delete it.
--
Andrew I MacIntyre "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au (pref) | Snail: PO Box 370
andymac at pcug.org.au (alt) | Belconnen ACT 2616
Web: http://www.andymac.org/ | Australia
More information about the Python-list
mailing list