in smart-mirror-full/extracted/device/script/src/agt/alexa_gadget.py [0:0]
def _load_gadget_config(self, gadget_config_path):
"""
If a path for the Gadget configuration .ini is passed in, then it will load that. Otherwise, if there is a
.ini file with the same prefix and the main .py file, then it will load that. Otherwise, an exception is thrown
asking the user to create the .ini file.
:param gadget_config_path:
"""
self.gadget_config_path = gadget_config_path
if not gadget_config_path:
# If no config file was passed in the constructor, then look for a file with the same as the .py file
gadget_config_path = sys.modules[self.__module__].__file__
self.gadget_config_path = gadget_config_path.replace('.py', '.ini')
# Make sure the config file exists and read it into the configparser
if path.exists(self.gadget_config_path):
self.gadget_config = configparser.ConfigParser()
self.gadget_config.optionxform = str
self.gadget_config.read([self.gadget_config_path])
else:
raise Exception('Please make sure you have created ' + self.gadget_config_path)