bsddb read-only requires rw access to close?

Skip Montanaro skip at pobox.com
Mon Sep 1 12:33:18 EDT 2003


    Harry> ... but if I change to read-only access (as in permissions on file):

    >>>> a = bsddb.btopen("c:/sharedrw/db/npanxx2pseudo.db", "r")
    >>>> a.close()

    Harry>         Traceback (most recent call last):
    Harry>           File "<pyshell#30>", line 1, in -toplevel-
    Harry>             a.close()
    Harry>           File "C:\Python23\lib\bsddb\__init__.py", line 101, in close
    Harry>             v = self.db.close()
    Harry>         DBPermissionsError: (1, 'Operation not permitted')

    Harry> Performing a close() with read/write access with file opened "r" does
    Harry> not change the last-modified time/date.

    Harry> Is this a bug?

Dunno.  Works for me on Mac OS X:

    % python
    Python 2.4a0 (#77, Aug 11 2003, 11:19:14) 
    [GCC 3.1 20020420 (prerelease)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import bsddb
    >>> db = bsddb.btopen("foo.bt", "c")
    >>> db['1'] = '1'
    >>> db.close()
    >>> 
    % chmod 444 foo.bt
    % python
    Python 2.4a0 (#77, Aug 11 2003, 11:19:14) 
    [GCC 3.1 20020420 (prerelease)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import bsddb
    >>> db = bsddb.btopen("foo.bt", "r")
    >>> db.close()
    >>> 

Skip





More information about the Python-list mailing list