From 5eb989f2ba9a3ff601f31437049b1bfbcb9a836d Mon Sep 17 00:00:00 2001 From: Melbar Date: Fri, 8 May 2026 08:35:41 +0200 Subject: [PATCH] Improve Python launcher discovery docs --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++--- create_mezzanine.bat | 44 ++++++++++++++++++++++++++++++---- 2 files changed, 93 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 328edb0..8540b9b 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,39 @@ Wichtig: Das Fenster waehrend des Encodings offen lassen. Am Ende bleibt es steh - FFmpeg und FFprobe - Schreibzugriff auf das Zielverzeichnis +Hinweis: Auf manchen Windows-Rechnern gibt es den Befehl `py` nicht. Das ist normal. `create_mezzanine.bat` sucht deshalb automatisch nach mehreren Python-Varianten: + +1. lokale Python-Installationen wie `Python313`, `Python312`, `Python311`, `Python310` +2. `py` +3. `python` +4. `python3` + +Wenn nichts davon gefunden wird, zeigt die Batch-Datei eine Installationsmeldung. + +### Python und `py` installieren + +`py` ist ein kleiner Python-Starter fuer Windows. Er hilft, die passende Python-Version zu finden. Fuer dieses Tool ist `py` praktisch, aber nicht zwingend notwendig, weil `create_mezzanine.bat` auch nach `python` und lokalen Python-Installationen sucht. + +Einfachster Weg fuer einen neuen Rechner: + +1. Python fuer Windows von [python.org](https://www.python.org/downloads/windows/) installieren. +2. Im Installer diese Optionen aktivieren: + - `Add python.exe to PATH` + - `py launcher` bzw. `Python Launcher for Windows`, falls angeboten + - `tcl/tk and IDLE`, damit die grafische Oberflaeche funktioniert +3. Nach der Installation ein neues PowerShell-Fenster oeffnen. +4. Pruefen: + ```powershell + python --version + py --version + ``` + +Wenn `python --version` funktioniert, aber `py --version` nicht, ist das fuer dieses Tool nicht schlimm. Dann startet die Batch-Datei Python ueber `python`. + +Wenn weder `python` noch `py` funktioniert, Python erneut installieren und darauf achten, dass `Add python.exe to PATH` aktiviert ist. + +Bei neueren Python-Versionen kann auch der Python Install Manager verwendet werden. Danach sollten normalerweise `python` und `py` verfuegbar sein. + FFmpeg und FFprobe werden automatisch gesucht: 1. explizite Pfade aus `config.ini` @@ -64,13 +97,19 @@ Mit direktem Dateiparameter: Direkt per Python: ```powershell -py -3 .\pvd_mezzanine.py "D:\Trailers\Film_DEU51_ENG20.mov" +python .\pvd_mezzanine.py "D:\Trailers\Film_DEU51_ENG20.mov" ``` Kompatibler CLI-Modus: ```powershell -py -3 .\pvd_mezzanine.py --cli "D:\Trailers\Film_DEU51_ENG20.mov" +python .\pvd_mezzanine.py --cli "D:\Trailers\Film_DEU51_ENG20.mov" +``` + +Falls `python` nicht gefunden wird, aber der Python-Launcher vorhanden ist: + +```powershell +py -3 .\pvd_mezzanine.py "D:\Trailers\Film_DEU51_ENG20.mov" ``` Wenn Tkinter in der verwendeten Python-Installation verfuegbar ist, startet eine UI mit Analyse, Audio-Uebersicht und Encoding-Log. @@ -122,11 +161,23 @@ Wenn Python nicht in der App-Liste auftaucht oder die Option fehlt, Python von [ Pruefen, ob Tkinter verfuegbar ist: +```powershell +python -m tkinter +``` + +Wenn `python` nicht gefunden wird, alternativ versuchen: + ```powershell py -3 -m tkinter ``` -Wenn ein kleines Testfenster erscheint, ist Tkinter installiert. Wenn eine Fehlermeldung erscheint, fehlt Tkinter in dieser Python-Installation. +Wenn ein kleines Testfenster erscheint, ist Tkinter installiert. Wenn eine Fehlermeldung erscheint, fehlt Tkinter in dieser Python-Installation oder Python ist nicht im `PATH`. + +Wenn weder `python` noch `py` gefunden wird, Python neu von [python.org](https://www.python.org/downloads/windows/) installieren. Im Installer diese Optionen aktivieren: + +- `Add python.exe to PATH` +- `py launcher` bzw. `Python Launcher for Windows`, falls angeboten +- `tcl/tk and IDLE` ## Ausgabe diff --git a/create_mezzanine.bat b/create_mezzanine.bat index 4554411..778a417 100644 --- a/create_mezzanine.bat +++ b/create_mezzanine.bat @@ -1,8 +1,42 @@ @echo off -set "PYTHON_EXE=%LocalAppData%\Programs\Python\Python311\python.exe" -if exist "%PYTHON_EXE%" ( - "%PYTHON_EXE%" "%~dp0pvd_mezzanine.py" %* -) else ( - py -3 "%~dp0pvd_mezzanine.py" %* +setlocal +set "SCRIPT=%~dp0pvd_mezzanine.py" +set "PYTHON_EXE=" +set "PYTHON_ARGS=" + +for %%V in (313 312 311 310) do ( + if not defined PYTHON_EXE if exist "%LocalAppData%\Programs\Python\Python%%V\python.exe" ( + set "PYTHON_EXE=%LocalAppData%\Programs\Python\Python%%V\python.exe" + ) ) + +if not defined PYTHON_EXE ( + where py.exe >nul 2>nul + if not errorlevel 1 ( + set "PYTHON_EXE=py" + set "PYTHON_ARGS=-3" + ) +) + +if not defined PYTHON_EXE ( + where python.exe >nul 2>nul + if not errorlevel 1 set "PYTHON_EXE=python" +) + +if not defined PYTHON_EXE ( + where python3.exe >nul 2>nul + if not errorlevel 1 set "PYTHON_EXE=python3" +) + +if not defined PYTHON_EXE ( + echo FEHLER: Python wurde nicht gefunden. + echo Bitte Python 3.10 oder neuer installieren: + echo https://www.python.org/downloads/windows/ + echo. + echo Im Installer "Add python.exe to PATH", "py launcher" und "tcl/tk and IDLE" aktivieren. + pause + exit /b 1 +) + +"%PYTHON_EXE%" %PYTHON_ARGS% "%SCRIPT%" %* pause