Ñò 4Mc @s¯dZddkZeidjoLddkZddkZddkZeiZdZei Z ei ƒZ nHeidjo+ddk Z e iZe iZe i Z n edƒ‚eidjod„Zd„Zn'eidjod „Zd „Zned jodd klZlZlZddkZddkZed dƒZeieeiƒedeeƒƒƒZeieƒdGHeiiƒZeiƒndS(sÚCross-platform (posix/nt) API for flock-style file locking. Synopsis: import portalocker file = open("somefile", "r+") portalocker.lock(file, portalocker.LOCK_EX) file.seek(12) file.write("foo") file.close() If you know what you're doing, you may choose to portalocker.unlock(file) before closing the file, but why? Methods: lock( file, flags ) unlock( file ) Constants: LOCK_EX LOCK_SH LOCK_NB I learned the win32 technique for locking files from sample code provided by John Nielsen in the documentation that accompanies the win32 modules. Author: Jonathan Feinberg Version: $Id: portalocker.py,v 1.3 2001/05/29 18:47:55 Administrator Exp $ iÿÿÿÿNtntitposixs3PortaLocker only defined for nt and posix platformscCs2ti|iƒƒ}ti||ddtƒdS(Niiÿÿ(t win32filet_get_osfhandletfilenot LockFileExt __overlapped(tfiletflagsthfile((sF/home/sa3ruby/intertwingly.net/code/venus/planet/vendor/portalocker.pytlock?scCs/ti|iƒƒ}ti|ddtƒdS(Niiÿÿ(RRRt UnlockFileExR(RR ((sF/home/sa3ruby/intertwingly.net/code/venus/planet/vendor/portalocker.pytunlockCscCsti|iƒ|ƒdS(N(tfcntltflockR(RR((sF/home/sa3ruby/intertwingly.net/code/venus/planet/vendor/portalocker.pyR HscCsti|iƒtiƒdS(N(R RRtLOCK_UN(R((sF/home/sa3ruby/intertwingly.net/code/venus/planet/vendor/portalocker.pyR Kst__main__(ttimetstrftimet localtimeslog.txtsa+s%m/%d/%Y %H:%M:%S s'Wrote lines. Hit enter to release lock.(t__doc__tostnametwin32conRt pywintypestLOCKFILE_EXCLUSIVE_LOCKtLOCK_EXtLOCK_SHtLOCKFILE_FAIL_IMMEDIATELYtLOCK_NBt OVERLAPPEDRR t RuntimeErrorR R t__name__RRRtsyst portalockertopentlogt timestamptwritetstdintreadlinetdummytclose(((sF/home/sa3ruby/intertwingly.net/code/venus/planet/vendor/portalocker.pyt)s@