"Nemesis" <[EMAIL PROTECTED]> wrote:

> So the real filename may be different from the argument passed to
> "open". I have this problem, I want to delete (in some circustances) the
> file created by shelve.open, how can I know which is the name of this
> file (or files) ?

if you put the shelve in a subdirectory, and nuke the entire directory when
done, you don't have to know the names.

    dbfile = "mydatabase"
    if not os.path.isdir(dbfile):
        os.makedirs(dbfile)
    db = shelve.open(os.path.join(dbfile, "data"), ...)

    ...

    db.close()
    del db

    ...

    shutil.rmtree(dbfile)

</F>



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to