[Tutor] Moving a Shelf Between Linux and Mac OS X
Patrick Kenny
ptmkenny at gmail.com
Sun Oct 25 05:38:37 CET 2009
Greetings,
I recently started learning Python and I have written a script that uses
a shelf on Mac OS X using Python 2.6. I recently attempted to move the
directory over to my Linux system, which also has Python 2.6 installed,
and run the script there.
The script works fine, but the shelf does not load. Instead, it appears
that a new shelf is created. On the Mac, the shelf file is saved as
class-shelve.db, but after running the script on Linux, a new file,
class-shelve (without a .db suffix) is created.
I tried simply deleting class-shelve and renaming class-shelve.db as
class-shelve, but when I run the script I get this error:
Traceback (most recent call last):
File "card.py", line 232, in <module>
DisplayInventory(scope)
File "card.py", line 65, in DisplayInventory
db = shelve.open('class-shelve')
File "/usr/lib64/python2.6/shelve.py", line 234, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/usr/lib64/python2.6/shelve.py", line 218, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol,
writeback)
File "/usr/lib64/python2.6/anydbm.py", line 82, in open
mod = __import__(result)
ImportError: No module named bsddb185
Are shelves portable between different OSs? I would like to make the
data created on the shelf on the Mac also accessible on Linux; is there
an easy way to do this?
Cheers,
Patrick
More information about the Tutor
mailing list