def file_exits_and_not_zombie(file_path): """Checks for existence of ROOT file and ensures it is not a zombie and has its keys""" if os.path.isfile(file_path): f = TFile(file_path) if f.IsZombie() or f.GetSeekKeys() == 0: f.Close() return False else: f.Close() return True else: return False