diff --git a/install.bat b/install.bat index e0d45b8..fdb309a 100644 --- a/install.bat +++ b/install.bat @@ -91,6 +91,13 @@ exit /b 1 :env_created echo Botty Python: %PYTHON% +:: Prepend conda DLL dirs to PATH at the process level so the Windows DLL +:: loader finds tesseract51.dll's transitive deps (leptonica, zlib, etc.) +:: when ctypes loads it. os.environ['PATH'] set from inside Python is too late. +for %%F in ("%PYTHON%") do set "_CONDA_ENV=%%~dpF" +set "_CONDA_ENV=%_CONDA_ENV:~0,-1%" +set "PATH=%_CONDA_ENV%\Library\bin;%_CONDA_ENV%\Library\mingw-w64\bin;%_CONDA_ENV%\Library\usr\bin;%PATH%" + :: --- Force-reinstall the tesserocr wheel so the correct binary is always used --- echo. echo Installing tesserocr wheel... diff --git a/run_botty.bat b/run_botty.bat index 4e8c8c0..1d867a4 100644 --- a/run_botty.bat +++ b/run_botty.bat @@ -5,6 +5,13 @@ cd /d "%BOTTY_DIR%" call "%BOTTY_DIR%find_python.bat" +:: Prepend conda DLL dirs to PATH at the process level so the Windows DLL +:: loader finds tesseract51.dll's transitive deps (leptonica, zlib, etc.) +:: when ctypes loads it. os.environ['PATH'] set from inside Python is too late. +for %%F in ("%PYTHON%") do set "_CONDA_ENV=%%~dpF" +set "_CONDA_ENV=%_CONDA_ENV:~0,-1%" +set "PATH=%_CONDA_ENV%\Library\bin;%_CONDA_ENV%\Library\mingw-w64\bin;%_CONDA_ENV%\Library\usr\bin;%PATH%" + echo Launching Botty ... %PYTHON% "%BOTTY_DIR%src\main.py" pause