Code: Alles auswählen
IDLE 2.6.5
>>> import shelve
>>> t = 'test'
>>> with shelve.open('test') as db:
db['t'] = t
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
with shelve.open('test') as db:
File "C:\Python26\lib\shelve.py", line 239, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "C:\Python26\lib\shelve.py", line 223, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
File "C:\Python26\lib\anydbm.py", line 83, in open
return mod.open(file, flag, mode)
File "C:\Python26\lib\dbhash.py", line 19, in open
return bsddb.hashopen(file, flag, mode)
File "C:\Python26\lib\bsddb\__init__.py", line 361, in hashopen
d.open(file, db.DB_HASH, flags, mode)
DBPermissionsError: (1, 'Operation not permitted')
Code: Alles auswählen
Traceback (most recent call last):
File "C:\Dokumente und Einstellungen\Nebelhom\workspace\pyChemDataManager\src\compound.py", line 172, in <module>
with shelve.open('test.db') as db:
AttributeError: DbfilenameShelf instance has no attribute '__exit__'
PEP 343 hat mich auch nicht wirklich schlauer gemacht... Habe ich da mal wieder die Philosophie hinter einem neuen statement nicht verstanden?
Ach ja, ich benutze python 2.6. Danke schonmal fuer die Aufklaerung