I am hoping for a little advice on shelves/databases in Python.
Problem: I have a database created on the mac, that I want to use on windows 7. I use Python 3.2, MacOS 10.7, and win 7.
When I open and save my shelve on the mac all is good and well. I get a file with a ".db" extension. On my windows-python it is not recognized. I can however create a new db on the pc and get files with ".bak, dat, .dir" extensions.
I am guessing that the python on the pc does not have the same underlying database that my mac-python uses?
I am not sure which is the correct approach here, but maybe I could:
Change the default-db that my systems uses? Find out which db my mac-python uses and add that on the pc? Change the way I store my data all together?
Speed is not an issue, the datasize is a few megabytes, and it's not accessed very often.
Hope to find a helping hand out there. Thanks in advance - any help is much appreciated.
/Esben
What I am doing:
Import shelve
db = shelve.open('mydb')
entries = db['list']
db.close
It's pretty straight forward, I have a working db-file called "mydb.db" on the mac but when I try to open it on the pc-python i get:
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/dbm/init.py", line 107, in whichdb f = io.open(filename + ".pag", "rb") IOError: [Errno 2] No such file or directory: 'mydb.pag'