Help: using msvcrt for file locking

Sheila King sheila at spamcop.net
Sun Aug 26 15:17:04 EDT 2001


On Sun, 26 Aug 2001 14:52:25 -0400 (EDT), Ignacio Vazquez-Abrams
<ignacio at openservices.net> wrote in comp.lang.python in article
<mailman.998852019.16864.python-list at python.org>:

:I was just poking around in the Sleepycat documentation, and apparently they
:have some sort of locking scheme via their C API. Which version on Sleepycat
:do you currently have access to, and how are you accessing it? You'll have to
:excuse my naïveté when it comes to file-based databases.

SleepyCat 2.4.x, or something like that.
I'm accessing it via Python. Doesn't have file locking, like I mentioned
(somewhere I mentioned that...to many messages on this topic now...)

Here are the docs on how to access it via Python:
http://www.python.org/doc/current/lib/module-dbhash.html

Notice that you can append an optional 'l' to the mode, if your
installation supports locking.

Here is an interactive session:

Python 2.1.1 (#6, Aug 16 2001, 17:02:08)
[GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import dbhash
>>> db = dbhash.open('rec', 'rl')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/big/dom/xthinkspot/lib/python2.1/dbhash.py", line 16, in open
    return bsddb.hashopen(file, flag, mode)
bsddb.error: locking not supported on this platform
>>>

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/




More information about the Python-list mailing list