"shelve" save object

alex23 wuwei23 at gmail.com
Mon Aug 11 09:20:55 CEST 2008

hypermonkey2 wrote:
> In any case, I shelve into a file "test.txt". I notice that when i try
> running the program on a different computer (by either emailing or
> transfering the file "test.txt" via USB key), the program is unable to
> load the shelve file.

You might find the 3rd party module 'shove' is more suitable for your
needs here.


It provides a lot more backend support than shelve, of particular
interest to you would be filesystem (& maybe sqlite).

>>> from shove import Shove
>>> fsdb = Shove('file://persistent.db')
>>> fsdb['key1'] = 'value1'
>>> fsdb.close()

In this example, using the file protocol will produce a
'persistent.db' folder with the key/value pairs stored within it as
files. This should be cross platform enough for your needs.

More information about the Python-list mailing list