Spaces:
Paused
Paused
Download scripts/sitecustomize.py from Kraft102/widgettdc-api: direct link, hf CLI and curl.
- Browser
- Download file 631 Bytes
-
https://huggingface.co/spaces/Kraft102/widgettdc-api/resolve/main/scripts/sitecustomize.py
- Command line
-
hf download hf://spaces/Kraft102/widgettdc-api/scripts/sitecustomize.py
-
curl -L -o sitecustomize.py https://huggingface.co/spaces/Kraft102/widgettdc-api/resolve/main/scripts/sitecustomize.py
631 Bytes
| # sitecustomize.py - Set default encoding to UTF-8 for all Python scripts | |
| # Place this file in Python's site-packages directory to fix Windows emoji issues | |
| import sys | |
| import io | |
| # Force UTF-8 encoding for stdout and stderr | |
| if sys.stdout.encoding != 'utf-8': | |
| sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') | |
| if sys.stderr.encoding != 'utf-8': | |
| sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace') | |
| # Set default file encoding to UTF-8 | |
| import locale | |
| locale.setlocale(locale.LC_ALL, '') | |
| print("✅ UTF-8 encoding configured automatically", file=sys.stderr) | |