Spaces:
Sleeping
Sleeping
File size: 428 Bytes
6b45962 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#!/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!")
|