Files
my-botty/run_botty.bat

27 lines
842 B
Batchfile

@echo off
setlocal enabledelayedexpansion
set "BOTTY_DIR=%~dp0"
cd /d "%BOTTY_DIR%"
call "%BOTTY_DIR%find_python.bat"
:: Derive the conda env root from python.exe:
:: envs\botty\python.exe -> envs\botty
for %%F in ("%PYTHON%") do set "_ENV=%%~dpF"
set "_ENV=%_ENV:~0,-1%"
:: Match an activated conda environment closely enough for native DLL loading.
set "PATH=%_ENV%;%_ENV%\Scripts;%_ENV%\Library\bin;%_ENV%\Library\mingw-w64\bin;%_ENV%\Library\usr\bin;%_ENV%\DLLs;%PATH%"
set "CONDA_PREFIX=%_ENV%"
set "PYTHONUTF8=1"
set "PYTHONIOENCODING=utf-8"
set "SSL_CERT_DIR="
:: Use winget tesseract 5.5.0 (conda tesseract crashes with access violation)
set "TESSDATA_PREFIX=%_ENV%\Library\share"
set "PYTESSERACT_TESSERACT_CMD=C:\Program Files\Tesseract-OCR\tesseract.exe"
echo Launching Botty ...
"%PYTHON%" "%BOTTY_DIR%src\main.py"
pause