Skip to content

Show it a video you love. Get a new video in the same style. An AI crew (Claude Code or Codex) plans, builds and reviews it with you.

Find a working Python 3.10+ (python3/python/py) on every platform; tell agents which command to use

許元豪3b65411e0925
diff --git a/app/scripts/doctor.mjs b/app/scripts/doctor.mjs
index 3318e84..5602d30 100644
--- a/app/scripts/doctor.mjs
+++ b/app/scripts/doctor.mjs
@@ -1,4 +1,5 @@
// Checks everything ReelMimic needs and says how to fix what's missing. npm run doctor
+import '../server/env.mjs'; // same secrets and Python choice as the server
import { execFileSync } from 'node:child_process';
import { existsSync, readFileSync } from 'node:fs';
import { homedir, platform } from 'node:os';
diff --git a/app/server/env.mjs b/app/server/env.mjs
index ff27d00..5313ee6 100644
--- a/app/server/env.mjs
+++ b/app/server/env.mjs
@@ -1,6 +1,7 @@
// Loads optional settings/API keys from ~/.reelmimic/secrets.json (outside the repo, never committed) into process.env,
// so every agent and script the server launches sees them. Real environment variables win.
// { "YATING_KEY": "...", "PIXABAY_KEY": "...", "FREESOUND_KEY": "...", "FFMPEG_DIR": "...", "CODEX_BIN": "...", "BUILDERS": "5" }
+import { spawnSync } from 'node:child_process';
import { existsSync, readFileSync } from 'node:fs';
import { homedir } from 'node:os';
import { join } from 'node:path';
@@ -14,3 +15,12 @@ try {
for (const [k, v] of Object.entries(s)) if (process.env[k] === undefined && v != null) process.env[k] = String(v);
} catch {}
if (process.env.FFMPEG_DIR) process.env.PATH = `${process.env.FFMPEG_DIR}${process.platform === 'win32' ? ';' : ':'}${process.env.PATH}`;
+
+// Python: macOS/Linux often have only `python3`; Windows may have a Store stub named `python3`. Use the first command
+// that really runs Python 3.10+, and export it so every script, agent prompt and child process uses the same one.
+if (!process.env.PYTHON) {
+ for (const c of process.platform === 'win32' ? ['python', 'py', 'python3'] : ['python3', 'python']) {
+ const r = spawnSync(c, ['-c', 'import sys; print(sys.version_info >= (3, 10))'], { encoding: 'utf8', timeout: 15000 });
+ if ((r.stdout || '').trim() === 'True') { process.env.PYTHON = c; break; }
+ }
+}
diff --git a/app/server/prompts.mjs b/app/server/prompts.mjs
index de1603c..c14c040 100644
--- a/app/server/prompts.mjs
+++ b/app/server/prompts.mjs
@@ -26,7 +26,8 @@ const LANG_NAME = { 'zh-TW': '繁體中文', en: 'English', 'zh-CN': '简体中
const HEADER = (p, role = '導演') => `你是「風格克隆影片工作室」的${role} agent,工作目錄是 repo 根目錄。
本專案資料夾:${p.dir}(以下路徑都相對於它,除非寫明 repo 根目錄)
先讀:${SKILL}/SKILL.md(流程與規則)與 ${SKILL}/CONTRACT.md(檔案格式,必須照寫)。
-這一輪只做下面指定的步驟,做完就停,最後用 3–6 行${LANG_NAME[p.lang] || '繁體中文'}回報重點(不要貼整份檔案)。${p.lang && p.lang !== 'zh-TW' ? `
+${process.env.PYTHON && process.env.PYTHON !== 'python' ? `這台電腦的 Python 指令是 \`${process.env.PYTHON}\`:下面(和 skill 文件)寫 python 的地方都用它執行。
+` : ''}這一輪只做下面指定的步驟,做完就停,最後用 3–6 行${LANG_NAME[p.lang] || '繁體中文'}回報重點(不要貼整份檔案)。${p.lang && p.lang !== 'zh-TW' ? `
使用者的介面語言是 ${LANG_NAME[p.lang]}:回報與企劃裡給人看的文字(plan.json、STORYBOARD.md)都用${LANG_NAME[p.lang]}寫;影片裡的字幕與旁白語言照使用者的需求。` : ''}
${RULES}
${SPEED}`;
diff --git a/install.bat b/install.bat
index c3cb45d..7713a34 100644
--- a/install.bat
+++ b/install.bat
@@ -1,7 +1,13 @@
@echo off
rem ReelMimic - one-time setup: Python packages, web app, UI build, environment check.
cd /d "%~dp0"
-if "%PYTHON%"=="" set PYTHON=python
+rem first command that really runs Python 3.10+ (the Microsoft Store stub does not)
+if not "%PYTHON%"=="" goto :havepy
+python -c "import sys; sys.exit(0 if sys.version_info>=(3,10) else 1)" >nul 2>&1 && (set PYTHON=python& goto :havepy)
+py -c "import sys; sys.exit(0 if sys.version_info>=(3,10) else 1)" >nul 2>&1 && (set PYTHON=py& goto :havepy)
+echo Python 3.10+ not found. Install it from https://www.python.org (tick "Add to PATH"), or set PYTHON.
+goto :err
+:havepy
echo == Python packages
%PYTHON% -m pip install -r requirements.txt || goto :err
echo == Web app
diff --git a/install.sh b/install.sh
index 6ae4d66..24d1d68 100644
--- a/install.sh
+++ b/install.sh
@@ -2,7 +2,14 @@
# ReelMimic — one-time setup: Python packages, web app, UI build, environment check.
set -e
cd "$(dirname "$0")"
-PY="${PYTHON:-python3}"; command -v "$PY" >/dev/null || PY=python
+# first command that really runs Python 3.10+ (Windows may have a Store stub named python3)
+PY="${PYTHON:-}"
+if [ -z "$PY" ]; then
+ for c in python3 python py; do
+ if "$c" -c 'import sys; sys.exit(0 if sys.version_info >= (3, 10) else 1)' >/dev/null 2>&1; then PY="$c"; break; fi
+ done
+fi
+[ -n "$PY" ] || { echo "Python 3.10+ not found. Install it, or set PYTHON=/path/to/python"; exit 1; }
echo "== Python packages ($PY)"; "$PY" -m pip install -r requirements.txt
echo "== Web app"; cd app && npm install && npm run build
echo "== Environment check"; node scripts/doctor.mjs || true