Files
Vox/numba_config.py
Spencer 736a819493 feat: Rename pockettts service to vox and improve numba caching
Renamed the systemd service from "pockettts" to "vox" for better branding and clarity.
Updated the  script to reflect the new service name.

Addressed numba caching issues when running as a systemd service:
- Created  to explicitly set  to a project-local directory ().
- Modified  to import  early in the execution flow.
- Updated the systemd service file to grant write permissions to the  directory.
- Added  to  to prevent caching files from being committed.
2026-01-18 18:09:10 -06:00

20 lines
683 B
Python

import os
import sys
# Set a writable cache directory for Numba
# This is crucial when running as a systemd service with restricted home directory access.
# The cache will be created in the bot's root directory.
CACHE_DIR = os.path.join(os.path.dirname(__file__), '.numba_cache')
if not os.path.exists(CACHE_DIR):
try:
os.makedirs(CACHE_DIR)
print(f"Numba cache directory created at: {CACHE_DIR}")
except OSError as e:
print(f"Error creating Numba cache directory: {e}", file=sys.stderr)
# Set the environment variable for Numba
os.environ['NUMBA_CACHE_DIR'] = CACHE_DIR
print(f"Numba cache directory set to: {os.environ.get('NUMBA_CACHE_DIR')}")