diff --git a/scripts/configure_invokeai.py b/scripts/configure_invokeai.py index 46f652b15d..7694b1c710 100755 --- a/scripts/configure_invokeai.py +++ b/scripts/configure_invokeai.py @@ -232,7 +232,7 @@ def migrate_models_ckpt(): rename = yes_or_no(f'Ok to rename it to "{new_name}" for future reference?') if rename: print(f'model.ckpt => {new_name}') - os.rename(os.path.join(model_path,'model.ckpt'),os.path.join(model_path,new_name)) + os.replace(os.path.join(model_path,'model.ckpt'),os.path.join(model_path,new_name)) #--------------------------------------------- def download_weight_datasets(models:dict, access_token:str): @@ -340,12 +340,12 @@ def update_config_file(successfully_downloaded:dict,opt:dict): try: if os.path.exists(config_file): print(f'** {config_file} exists. Renaming to {config_file}.orig') - os.rename(config_file,f'{config_file}.orig') + os.replace(config_file,f'{config_file}.orig') tmpfile = os.path.join(os.path.dirname(config_file),'new_config.tmp') with open(tmpfile, 'w') as outfile: outfile.write(Config_preamble) outfile.write(yaml) - os.rename(tmpfile,config_file) + os.replace(tmpfile,config_file) except Exception as e: print(f'**Error creating config file {config_file}: {str(e)} **')