def isFileLocked(checkfile, writeLockCheck=False):
 checkfile = ek(os.path.abspath, checkfile)
 if (not ek(os.path.exists, checkfile)):
  return True
 try:
  f = ek(io.open, checkfile, u'rb')
  f.close()
 except IOError:
  return True
 if writeLockCheck:
  lockFile = (checkfile + u'.lckchk')
  if ek(os.path.exists, lockFile):
   ek(os.remove, lockFile)
  try:
   ek(os.rename, checkfile, lockFile)
   time.sleep(1)
   ek(os.rename, lockFile, checkfile)
  except (OSError, IOError):
   return True
 return False

def isFileLocked ( checkfile , writeLockCheck = False ) : checkfile = ek ( os . path . abspath , checkfile ) if ( not ek ( os . path . exists , checkfile ) ) : return True try : f = ek ( io . open , checkfile , u'rb' ) f . close ( ) except IOError : return True if writeLockCheck : lockFile = ( checkfile + u'.lckchk' ) if ek ( os . path . exists , lockFile ) : ek ( os . remove , lockFile ) try : ek ( os . rename , checkfile , lockFile ) time . sleep ( 1 ) ek ( os . rename , lockFile , checkfile ) except ( OSError , IOError ) : return True return False
checks to see if a file is locked .