Working through the Mark Lutz book Programming Python 3rd Edition. A couple of modules in the "Preview" chapter give me errors. Both on a shelve.open call:
Pretty simple code, (2nd example): =====code begin===== import shelve from people import Person, Manager bob = Person('Bob Smith', 42, 30000, 'sweng') sue = Person('Sue Jones', 45, 40000, 'music') tom = Manager('Tom Doe', 50, 50000) db = shelve.open('class-shelve') db['bob'] = bob db['sue'] = sue db['tom'] = tom db.close() ====code end==== Error message++++++++ Traceback (most recent call last): File "make_db_classes.py", line 9, in <module> db = shelve.open('class-shelve') File "C:\PYTHON25\lib\shelve.py", line 225, in open return DbfilenameShelf(filename, flag, protocol, writeback) File "C:\PYTHON25\lib\shelve.py", line 209, in __init__ Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback) File "C:\PYTHON25\lib\anydbm.py", line 83, in open return mod.open(file, flag, mode) File "C:\PYTHON25\lib\dbhash.py", line 16, in open return bsddb.hashopen(file, flag, mode) File "C:\PYTHON25\lib\bsddb\__init__.py", line 306, in hashopen d.open(file, db.DB_HASH, flags, mode) bsddb.db.DBError: (5, 'Input/output error') ++++++++++End Error message I've looked on the errata pages of his website and used Google to find someone else who ran into this problem. Found someone else who had a similar error but no explanation was given. No other reader of the book seems to have had the problem. I'm using 2.5.1 I thought maybe the file had to exist before it could be opened, so I created one with that name, but no dice. A different but similar set of errors. I also thought maybe there had to be a second argument like 'a', 'r' or 'w'. That doesn't work either. This is the first chapter of the book. It's an overview of the language features. So, this is pretty perplexing. Any help would be appreciated. Thanks. -- http://mail.python.org/mailman/listinfo/python-list