Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def flock(fd, blocking=False, exclusive=False):
- if exclusive:
- flags = fcntl.LOCK_EX
- else:
- flags = fcntl.LOCK_SH
- if not blocking:
- flags |= fcntl.LOCK_NB
- fcntl.flock(fd, flags)
- def flock(fd, blocking=False, exclusive=False):
- if blocking:
- flags = msvcrt.LK_NBLCK
- else:
- flags = msvcrt.LK_LOCK
- msvcrt.locking(fd.fileno(), flags, os.path.getsize(fd.name))
- for file in os.listdir(dir):
- f = open(file)
- flock(f)
- open(dirname)
- OSError: [Errno 13] Permission denied: dirname
Add Comment
Please, Sign In to add comment