When executing the same command on different platforms, the shelve module generates file (s) with different extensions. If you need more detail:
s = shelve.open("test", writeback=True)
When executing such a command, the following result is obtained:
- On linux-base systems, one file is generated called "test"
- On MacOS, one file is generated called "test.db"
- On Windows, three files are generated, each with the names "test.dir", "test.dat" and "test.bak"
This fact saddens and greatly interferes with the work of the code using the reading of the file generated by the shelve module on different platforms.
In search of an answer to the question: "Yes, how is that?!", I came across this page from the English language stackoverflow. As I understand it (and alas, my knowledge of English is not so great), the problem is that the shelve module uses the ( based on ) module anydbm, which, in turn, is a software interface using system database implementations, such as dbhash , gdbm , dbm and dumbdbm . Further, on the same page it is indicated that the implementation of the database, which generates three files in each, is dumbdbm.
From all that I was able to translate on this page, I suggested that the problem is incompatibility of database implementations on different systems. I tried installing gdbm on windows from here . I also made an attempt to add a folder containing binaries with gdbm to PATH, but this is not enough to allow the shelve on windows to read the shelve files that are generated in the linux-base system.
In general, the question is: how to correct this misunderstanding?
UPD: The question is old, but still open. Add: the task then was to serialize together with the object its methods and transfer this file to another OS.
shelve
- with his help open. - m9_psy