def checkParameter( self, parameter, var_type, value ) : parameter_error = None if not value: parameter_error = 'Error: Parameter "' + parameter + '" can not be empty.' else: if var_type == Step.type_folder : try: tools.check_folder( value ) except Exception as e: parameter_error = str(e) elif var_type == Step.type_file : try: tools.check_file( value ) except Exception as e: parameter_error = str(e) elif var_type == Step.type_number : try: self.checkNumber( value ) except Exception as e: parameter_error = str(e) elif var_type == Step.type_string or var_type == Step.type_ignore: parameter_error = None # anything goes. else : parameter_error = "Command line var_type not recognised. Should be set to folder, file, number, string or ignore." if parameter_error : parameter_error = 'Error: Parameter "' + parameter + '" - ' + parameter_error return parameter_error
def step(self): try: self.setVariables() tools.check_folder(self.process_path) self.createFolders(self.process_path, self.folder_structure.items()) except Exception as e: error = str(e) self.error_message(error) raise e