利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.
Python ai-video-generatorcontent-creationffmpeginstagram-reelsllmpythonshort-videosubtitlestext-to-speechtiktokvideo-automationvideo-workflowworkflow-automationyoutube-shorts
Fix UnicodeEncodeError that kills the CLI after a successful run
housine35fe29211a082b
diff --git a/cli.py b/cli.pyindex 90053fb7..4c18f775 100644--- a/cli.py+++ b/cli.py@@ -7,6 +7,7 @@ import mathimport osimport reimport shutil+import sysfrom typing import TYPE_CHECKING, Any, Sequencefrom uuid import UUID, uuid4@@ -1496,5 +1497,26 @@ def run_cli(argv: Sequence[str] | None = None) -> int:return 0+def _force_utf8_console() -> None:+ """Make stdout/stderr UTF-8 before anything is printed.++ Windows consoles default to a legacy code page (cp1252 in Western+ Europe). Generating a French video produces U+202F, the narrow no-break+ space French typography puts before ':' and '!', and Loguru's own progress+ lines carry circled digits. Either one raises UnicodeEncodeError, which+ kills the process *after* the video was written successfully -- so the run+ reports failure and never prints where the file is.+ """+ for stream in (sys.stdout, sys.stderr):+ reconfigure = getattr(stream, "reconfigure", None)+ if reconfigure is None:+ continue+ try:+ reconfigure(encoding="utf-8", errors="replace")+ except (ValueError, OSError):+ continue++if __name__ == "__main__":+ _force_utf8_console()raise SystemExit(run_cli())