portalocker.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:python-agent 作者: sandabuliu 项目源码 文件源码
def lock(file, flags):
        hfile = win32file._get_osfhandle(_getfd(file))
        try:
            win32file.LockFileEx(hfile, flags, 0, -0x10000, __overlapped)
        except pywintypes.error, exc_value:
            # error: (33, 'LockFileEx', 'The process cannot access the file because another process has locked a portion of the file.')
            if exc_value[0] == 33:
                raise LockException(LockException.LOCK_FAILED, exc_value[2])
            else:
                # Q:  Are there exceptions/codes we should be dealing with here?
                raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号