Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def loadExploration(self, name):
explo_path = qi.path.findData(self.explorer_application_name, name + self.explo_extension, False)
if len(explo_path) > 0:
try:
if not(self.nav.loadExploration(explo_path)):
return False
self.current_places = {}
self.current_places["name"] = name
self.current_places["places"] = {}
except Exception as e:
self.logger.error("Unable to load explo: " + str(e))
return False
return True
self.logger.error("No such explo file: " + name)
return False
def loadPlaces(self, name):
self.logger.info("load places")
available_explo = qi.path.findData(self.application_name, name + self.places_extension, False)
if len(available_explo) > 0:
#load an existing annotated explo
in_file = open(available_explo, "rb")
data = pickle.load(in_file)
in_file.close()
if not("name" in data) or not("places" in data):
self.logger.error("wrong annoted explo format")
return False
self.current_places = data
explo_path = qi.path.findData(self.explorer_application_name, name + self.explo_extension, False)
if len(explo_path) > 0:
try:
self.nav.loadExploration(explo_path)
except Exception as e:
self.logger.warning("Unable to load places: " + str(e))
return False
else:
return False
elif not(self.loadExploration(name)):
return False
self.showPlaces()
return True