def _CONFIGURE(self): """ Prompt user for settings as needed for yaml """ with open(self.default_yaml, 'r') as stream: try: config_dict = yaml.load(stream) except yaml.YAMLError as exc: ErrorObject.print_error( message = 'default YAML read error' ) return None output_dict = {} for j, k in config_dict.iteritems(): sys.stdout.write('\r') new_value = raw_input('%s :' % (j)) # clean tailing slashes here if new_value is not None and len(new_value) > 0 and new_value[-1] == '/': # if output_dict[j] = new_value[:-1] else: output_dict[j] = new_value sys.stdout.flush() with open(self.instance_yaml, 'w') as outfile: outfile.write( yaml.dump( output_dict, default_flow_style=False ) ) self.settings_dict = output_dict
def _CONFIGURE(self): """ Prompt user for settings as needed for yaml """ with open(self.default_yaml, 'r') as stream: try: config_dict = yaml.load(stream) except yaml.YAMLError as exc: ErrorObject.print_error(message='default YAML read error') return None output_dict = {} for j, k in config_dict.iteritems(): sys.stdout.write('\r') new_value = raw_input('%s :' % (j)) # clean tailing slashes here if new_value is not None and len( new_value) > 0 and new_value[-1] == '/': # if output_dict[j] = new_value[:-1] else: output_dict[j] = new_value sys.stdout.flush() with open(self.instance_yaml, 'w') as outfile: outfile.write(yaml.dump(output_dict, default_flow_style=False)) self.settings_dict = output_dict
def _READ_SETTINGS(self): """ Read Extant Settings or Generate New Ones """ if not os.path.exists(self.instance_yaml): ErrorObject.print_error(message='Not Configured') return None with open(self.instance_yaml, 'r') as stream: try: self.settings_dict = yaml.load(stream) except yaml.YAMLError as exc: ErrorObject.print_error(message='Config YAML read error') return None
def _READ_SETTINGS(self): """ Read Extant Settings or Generate New Ones """ if not os.path.exists(self.instance_yaml): ErrorObject.print_error( message = 'Not Configured' ) return None with open(self.instance_yaml, 'r') as stream: try: self.settings_dict = yaml.load(stream) except yaml.YAMLError as exc: ErrorObject.print_error( message = 'Config YAML read error' ) return None