Reputation: 287
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
>>>
Upvotes: 4
Views: 4599
Reputation: 85095
As noted in the Python Standard Library documentation,
The following constants are options for the flags parameter to the open() function. They can be combined using the bitwise OR operator |. Some of them are not available on all platforms. For descriptions of their availability and use, consult the open(2) manual page on Unix or the MSDN on Windows.
O_EXLOCK
originated in the BSD world; it is not normally available on Linux. You might be able to use the Python fcntl
module instead.
Upvotes: 7