Spaces:
Runtime error
Runtime error
| import os | |
| import zipfile | |
| import sys | |
| ZIP_NAME = "musicnbrain.zip" | |
| MARKER = ".unzipped_ok" | |
| def unzip_once(): | |
| print("Starting unzip script...") | |
| if not os.path.exists(ZIP_NAME): | |
| print(f"'{ZIP_NAME}' not found — nothing to unzip.") | |
| return | |
| if os.path.exists(MARKER): | |
| print("Already unzipped. Skipping.") | |
| return | |
| try: | |
| with zipfile.ZipFile(ZIP_NAME, "r") as zf: | |
| print(f"Extracting {ZIP_NAME}...") | |
| zf.extractall(".") | |
| print("Extraction complete.") | |
| os.remove(ZIP_NAME) | |
| print("Deleted zip file.") | |
| open(MARKER, "w").close() | |
| print("Created marker file.") | |
| print("\nExtracted files:") | |
| for root, dirs, files in os.walk("."): | |
| for file in files: | |
| print(os.path.join(root, file)) | |
| except Exception as e: | |
| print("Unzip failed:", e) | |
| if __name__ == "__main__": | |
| unzip_once() | |
| sys.exit(0) | |