def exists_in(dirname, indexname=None):
 if os.path.exists(dirname):
  try:
   ix = open_dir(dirname, indexname=indexname)
   return (ix.latest_generation() > (-1))
  except EmptyIndexError:
   pass
 return False

def exists_in ( dirname , indexname = None ) : if os . path . exists ( dirname ) : try : ix = open_dir ( dirname , indexname = indexname ) return ( ix . latest_generation ( ) > ( - 1 ) ) except EmptyIndexError : pass return False
returns true if dirname contains a whoosh index .