else: print(f'logging config file {filename} not found.') logging.basicConfig(level=logging.INFO) setup_logger('logging.yaml') config = configuration() d = DataDir(config) logger = logging.getLogger(__name__) if config['action'].as_str() == 'init': d.UpdateAll() if config['action'].as_str() == 'process': for userid in d.Users(): if not os.path.exists(d.user_config_path(userid)): raise ValueError(f'config file for user {userid} not found') user_data = DataDir(config) user_data.add_config(d.user_config_path(userid)) #acc = d.UserAccounts(userid) # try to convert xls to xlsx for datafile in d.UserXLSDataFiles(userid): try: import pyexcel as p xlsx_file = datafile + 'x' logger.info(f'Trying to convert {datafile} to {xlsx_file}') if os.path.exists(xlsx_file): logger.info(f'IGNORED (Already exists) {xlsx_file}')
def action_user(d: DataDir, config: Configuration, logger: Logger, f): for userid in d.Users(): f(d, config, logger, userid)