I have a python3 script that creates several database files using the shelve module. FYI, the shelf module wraps the dbm module, as can be seen from defer the source code . The shelf.open () method is used to create a database file on disk and takes the desired path to the output file as an argument. However, the name of the generated file depends on the dbm modules available on the user system. This means that the behavior is not platform aggregated, as described elsewhere on SO: here .
I could not find a simple method to search for file names. I was hoping that I could access the file name (s) as the attribute (s) of the shelf object, for example, can be done using the FileIO file name attribute . How to get the file name (s) of a shelf object through an attribute or method of an object?
Otherwise, I could resort to passing the self-destructive tempfile object to the .open () shelf instead. However, I do not understand how to do this. Please note that the question about the time shelf was asked on SO here ... but the provided answer will not work if the user is on the system with the dbm module, which will attach the suffix fname.
Thank you for your time.
source share