Grio43 commited on
Commit
f7570f9
·
verified ·
1 Parent(s): 32ba153

Update web interface

Browse files
Files changed (1) hide show
  1. run.bat +50 -0
run.bat ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ setlocal enabledelayedexpansion
3
+ cd /d "%~dp0"
4
+
5
+ rem Force a UTF-8 console + UTF-8 mode in Python so prints with em-dashes and
6
+ rem the like don't crash on machines whose console codepage is cp1252 / cp932.
7
+ chcp 65001 >nul 2>nul
8
+ set "PYTHONUTF8=1"
9
+ set "PYTHONIOENCODING=utf-8"
10
+
11
+ rem Pick a Python launcher. Try py first (works on most python.org installs),
12
+ rem then `python`, then `python3`. enabledelayedexpansion + !ERRORLEVEL! is
13
+ rem required so each check reads the value AFTER the preceding `where` runs.
14
+ set "PYCMD="
15
+
16
+ where py >nul 2>nul
17
+ if !ERRORLEVEL! EQU 0 set "PYCMD=py"
18
+
19
+ if not defined PYCMD (
20
+ where python >nul 2>nul
21
+ if !ERRORLEVEL! EQU 0 set "PYCMD=python"
22
+ )
23
+
24
+ if not defined PYCMD (
25
+ where python3 >nul 2>nul
26
+ if !ERRORLEVEL! EQU 0 set "PYCMD=python3"
27
+ )
28
+
29
+ if not defined PYCMD (
30
+ echo [run.bat] No Python found on PATH.
31
+ echo [run.bat] Install Python 3.10+ from https://www.python.org/downloads/
32
+ echo [run.bat] During install, tick "Add Python to PATH".
33
+ pause
34
+ exit /b 1
35
+ )
36
+
37
+ echo [run.bat] Using !PYCMD! to launch app.py.
38
+ echo [run.bat] First run creates .venv and installs ~500 MB of packages.
39
+ echo [run.bat] That can take several minutes; it only happens once.
40
+ echo.
41
+
42
+ !PYCMD! "%~dp0app.py" %*
43
+ set "EXITCODE=!ERRORLEVEL!"
44
+
45
+ if !EXITCODE! NEQ 0 (
46
+ echo.
47
+ echo [run.bat] app.py exited with code !EXITCODE!.
48
+ pause
49
+ )
50
+ endlocal & exit /b %EXITCODE%