As you can see below, I’m running Python 2.6 on Linux (RHEL), but it doesn’t have os.O_EXLOCK for some reason. Is there some reason why? And is there a way around this?
Python 2.6.5 (r265:79063, Apr 9 2010, 11:16:46)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.O_EXLOCK
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'O_EXLOCK'
>>> os.O_DSYNC
4096
>>>
As noted in the Python Standard Library documentation,
O_EXLOCKoriginated in the BSD world; it is not normally available on Linux. You might be able to use the Pythonfcntlmodule instead.