Spaces:
Running
Running
fix(sync): guard prune_remote_deleted_files against missing API method
Browse filesdelete_files() is only available in newer huggingface_hub versions.
Wrap call in try/except so an AttributeError or API failure doesn't
crash the sync loop and leave workspace state inconsistent.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- openclaw-sync.py +4 -1
openclaw-sync.py
CHANGED
|
@@ -483,7 +483,10 @@ def _sync_once_unlocked(
|
|
| 483 |
commit_message=f"HuggingClaw sync {time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())}",
|
| 484 |
ignore_patterns=[".git/*", ".git"],
|
| 485 |
)
|
| 486 |
-
|
|
|
|
|
|
|
|
|
|
| 487 |
finally:
|
| 488 |
shutil.rmtree(snapshot_dir, ignore_errors=True)
|
| 489 |
|
|
|
|
| 483 |
commit_message=f"HuggingClaw sync {time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())}",
|
| 484 |
ignore_patterns=[".git/*", ".git"],
|
| 485 |
)
|
| 486 |
+
try:
|
| 487 |
+
prune_remote_deleted_files(repo_id, snapshot_dir)
|
| 488 |
+
except Exception as prune_exc:
|
| 489 |
+
print(f"Warning: could not prune stale remote files: {prune_exc}")
|
| 490 |
finally:
|
| 491 |
shutil.rmtree(snapshot_dir, ignore_errors=True)
|
| 492 |
|