Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Directory status checker for BytePlus Image Generation Studio | |
| """ | |
| import os | |
| from pathlib import Path | |
| def check_directory_status(): | |
| """Check the status of all required directories""" | |
| print("π Directory Status Check") | |
| print("=" * 40) | |
| # Check main directories | |
| directories = { | |
| "Cache Directory": ".cache", | |
| "Generated Images": "Generated", | |
| "Static Files": "static", | |
| "Session Viewer": "view_session" | |
| } | |
| for name, path in directories.items(): | |
| path_obj = Path(path) | |
| print(f"\nπ {name}:") | |
| print(f" Path: {path}") | |
| if path_obj.exists(): | |
| if path_obj.is_symlink(): | |
| target = path_obj.readlink() | |
| print(f" Status: β Symbolic link -> {target}") | |
| else: | |
| print(f" Status: β Directory exists") | |
| # Check permissions | |
| try: | |
| items = list(path_obj.iterdir()) | |
| print(f" Contents: {len(items)} items") | |
| if items: | |
| print(f" Sample: {[item.name for item in items[:3]]}") | |
| else: | |
| print(f" Contents: Empty") | |
| except PermissionError: | |
| print(f" Status: β Permission denied") | |
| except Exception as e: | |
| print(f" Status: β οΈ Error accessing: {e}") | |
| else: | |
| print(f" Status: β Does not exist") | |
| # Check cache directory permissions | |
| print(f"\nπ Permissions Check:") | |
| cache_path = Path(".cache") | |
| if cache_path.exists(): | |
| stat_info = cache_path.stat() | |
| permissions = oct(stat_info.st_mode)[-3:] | |
| print(f" Cache directory permissions: {permissions}") | |
| if permissions == "755": | |
| print(" β Permissions are correct") | |
| else: | |
| print(" β οΈ Permissions may need adjustment") | |
| # Check if app is ready to run | |
| print(f"\nπ App Status:") | |
| app_file = Path(".cache/app.py") | |
| if app_file.exists(): | |
| print(" β App is downloaded and ready to run") | |
| print(" π‘ Use: python run_app.py") | |
| else: | |
| print(" β App not downloaded yet") | |
| print(" π‘ Use: python app.py (to download first)") | |
| if __name__ == "__main__": | |
| check_directory_status() |