fix(run.bat): evita Microsoft Store Python stub care termina cmd.exe
Store stub-ul pentru python.exe termina procesul batch cand e apelat direct. Fix: foloseste 'py' launcher (safe) sau detecteaza python.exe real via 'where | findstr /v WindowsApps', fara a executa python in contextul check-ului. Toate apelurile python -> !PYTHON_CMD!. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
30
run.bat
30
run.bat
@@ -18,17 +18,31 @@ set "NEED_WHISPER="
|
|||||||
set "NEED_MODEL="
|
set "NEED_MODEL="
|
||||||
|
|
||||||
:: --- Python ---
|
:: --- Python ---
|
||||||
python --version >nul 2>&1
|
:: Avoid executing python.exe directly — the Microsoft Store stub terminates cmd.exe.
|
||||||
if errorlevel 1 (
|
:: Use 'py' launcher first (safe), then find python.exe excluding WindowsApps stub.
|
||||||
|
set "PYTHON_CMD="
|
||||||
|
where py >nul 2>&1
|
||||||
|
if not errorlevel 1 (
|
||||||
|
set "PYTHON_CMD=py"
|
||||||
|
for /f "tokens=2" %%v in ('py --version 2^>^&1') do echo [OK] Python %%v (py launcher^)
|
||||||
|
)
|
||||||
|
if not defined PYTHON_CMD (
|
||||||
|
for /f "delims=" %%p in ('where python 2^>nul ^| findstr /v /i "WindowsApps"') do (
|
||||||
|
if not defined PYTHON_CMD (
|
||||||
|
set "PYTHON_CMD=%%p"
|
||||||
|
for /f "tokens=2" %%v in ('"%%p" --version 2^>^&1') do echo [OK] Python %%v
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if not defined PYTHON_CMD (
|
||||||
echo [X] Python NOT FOUND
|
echo [X] Python NOT FOUND
|
||||||
|
echo The Microsoft Store stub does not count as a real Python install.
|
||||||
echo Install from: https://www.python.org/downloads/
|
echo Install from: https://www.python.org/downloads/
|
||||||
echo Make sure to check "Add Python to PATH" during install.
|
echo Make sure to check "Add Python to PATH" during install.
|
||||||
echo.
|
echo.
|
||||||
echo Cannot continue without Python. Install it and re-run.
|
echo Cannot continue without Python. Install it and re-run.
|
||||||
pause
|
pause
|
||||||
exit /b 1
|
exit /b 1
|
||||||
) else (
|
|
||||||
for /f "tokens=2" %%v in ('python --version 2^>^&1') do echo [OK] Python %%v
|
|
||||||
)
|
)
|
||||||
|
|
||||||
:: --- .env credentials ---
|
:: --- .env credentials ---
|
||||||
@@ -156,7 +170,7 @@ if defined NEED_FFMPEG (
|
|||||||
echo ============================================================
|
echo ============================================================
|
||||||
echo Auto-downloading ffmpeg...
|
echo Auto-downloading ffmpeg...
|
||||||
echo ============================================================
|
echo ============================================================
|
||||||
python setup_whisper.py ffmpeg
|
"!PYTHON_CMD!" setup_whisper.py ffmpeg
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: Could not install ffmpeg.
|
echo ERROR: Could not install ffmpeg.
|
||||||
@@ -178,7 +192,7 @@ if defined NEED_WHISPER (
|
|||||||
echo ============================================================
|
echo ============================================================
|
||||||
echo Auto-downloading whisper.cpp (CPU build^)...
|
echo Auto-downloading whisper.cpp (CPU build^)...
|
||||||
echo ============================================================
|
echo ============================================================
|
||||||
python setup_whisper.py whisper
|
"!PYTHON_CMD!" setup_whisper.py whisper
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: Failed to auto-download whisper.cpp.
|
echo ERROR: Failed to auto-download whisper.cpp.
|
||||||
@@ -200,7 +214,7 @@ if defined NEED_MODEL (
|
|||||||
echo Auto-downloading Whisper model (ggml-medium-q5_0, ~500 MB^)...
|
echo Auto-downloading Whisper model (ggml-medium-q5_0, ~500 MB^)...
|
||||||
echo This will take a few minutes depending on your connection.
|
echo This will take a few minutes depending on your connection.
|
||||||
echo ============================================================
|
echo ============================================================
|
||||||
python setup_whisper.py model
|
"!PYTHON_CMD!" setup_whisper.py model
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: Failed to download model.
|
echo ERROR: Failed to download model.
|
||||||
@@ -225,7 +239,7 @@ echo.
|
|||||||
:: ============================================================
|
:: ============================================================
|
||||||
if not exist ".venv\Scripts\python.exe" (
|
if not exist ".venv\Scripts\python.exe" (
|
||||||
echo [1/4] Creating Python virtual environment...
|
echo [1/4] Creating Python virtual environment...
|
||||||
python -m venv .venv
|
"!PYTHON_CMD!" -m venv .venv
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo ERROR: Failed to create venv.
|
echo ERROR: Failed to create venv.
|
||||||
pause
|
pause
|
||||||
|
|||||||
Reference in New Issue
Block a user