From a78f20178d057c2da9318ef7e07b10ca66562f2a Mon Sep 17 00:00:00 2001 From: doctorpangloss <@hiddenswitch.com> Date: Wed, 25 Sep 2024 10:16:56 -0700 Subject: [PATCH] Fix linking error --- comfy/model_downloader.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/comfy/model_downloader.py b/comfy/model_downloader.py index 2b9e3345c..d6ddfdc5b 100644 --- a/comfy/model_downloader.py +++ b/comfy/model_downloader.py @@ -132,20 +132,23 @@ def get_or_download(folder_name: str, filename: str, known_files: Optional[List[ del v logging.info(f"Converted {path} to 16 bit, size is {os.stat(path, follow_symlinks=True).st_size}") - link_exc_info = None + link_successful = True if linked_filename is not None: destination_link = os.path.join(this_model_directory, linked_filename) try: os.makedirs(this_model_directory, exist_ok=True) os.symlink(path, destination_link) except Exception as exc_info: + logging.error("error while symbolic linking", exc_info=exc_info) try: os.link(path, destination_link) - except Exception as exc_info: + except Exception as hard_link_exc: + logging.error("error while hard linking", exc_info=hard_link_exc) if cache_hit: shutil.copyfile(path, destination_link) - link_exc_info = exc_info - if link_exc_info is not None: + link_successful = False + + if not link_successful: logging.error(f"Failed to link file with alternative download save name in a way that is compatible with Hugging Face caching {repr(known_file)}. If cache_hit={cache_hit} is True, the file was copied into the destination.", exc_info=exc_info) else: url: Optional[str] = None