ipad-vad-training / clear_cache.py
MSherbinii's picture
Force cache clear on app startup to ensure fresh module loading
6b45962
raw
history blame contribute delete
428 Bytes
#!/usr/bin/env python3
"""Clear Python cache before starting app"""
import os
import shutil
from pathlib import Path
# Clear all __pycache__ directories
for pycache in Path('.').rglob('__pycache__'):
print(f"Removing {pycache}")
shutil.rmtree(pycache, ignore_errors=True)
# Clear .pyc files
for pyc in Path('.').rglob('*.pyc'):
print(f"Removing {pyc}")
pyc.unlink(missing_ok=True)
print("✅ Cache cleared!")