Linux上的Python中不存在os.O_EXLOCK(独占锁)
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Linux上的Python中不存在os.O_EXLOCK(独占锁),小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含917字,纯文字阅读大概需要2分钟。
内容图文
![Linux上的Python中不存在os.O_EXLOCK(独占锁)](/upload/InfoBanner/zyjiaocheng/968/5474f42adfb84c0e845b3c382cb6ddd5.jpg)
正如您在下面看到的,我在Linux(RHEL)上运行Python 2.6,但由于某种原因它没有os.O_EXLOCK.有什么理由吗?有没有办法解决这个问题?
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
>>>
解决方法:
如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;它通常不适用于Linux.您也许可以使用Python fcntl module.
内容总结
以上是互联网集市为您收集整理的Linux上的Python中不存在os.O_EXLOCK(独占锁)全部内容,希望文章能够帮你解决Linux上的Python中不存在os.O_EXLOCK(独占锁)所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。