Repository navigation
fix(piper_tts): resolve piper next to sys.executable before PATH - #940
Open
gauravchahal20 wants to merge 1 commit into
Open
gauravchahal20 wants to merge 1 commit into
gauravchahal20 wants to merge 1 commit into
Conversation
When running python from a virtual environment without activating the venv, piper binary resides in the venv's bin/Scripts directory and is not on PATH. Resolving piper next to sys.executable before falling back to PATH ensures PiperTTS reports AVAILABLE and executes successfully. Fixes OpenMontageInc#888
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves
pipernext tosys.executable(e.g..venv/binor.venv/Scripts) before falling back toPATH, soPiperTTSis detected asAVAILABLEand functions when executing via virtualenv Python without an activated virtualenv environment onPATH.Related issue
Closes #888
Root Cause
piperinstalls its CLI script into the virtualenv's binary directory (.venv/binon POSIX or.venv/Scriptson Windows). When an agent, IDE, or script runs.venv/bin/pythonwithout activating the virtualenv,shutil.which("piper")checks only the inheritedPATHand fails to locatepiper. Consequently, preflight reportstts 0/18and pipelines requiring local offline TTS are blocked.Changes
PiperTTS._find_piper: checks forpiperorpiper.exeinPath(sys.executable).parentbefore checkingshutil.which("piper").PiperTTS.get_status()to useself._find_piper().PiperTTS.check_dependencies()to verify binary presence viaself._find_piper().PiperTTS._generate()to invoke the resolved executable path.tests/tools/test_piper_tts.pycovering resolution next tosys.executable, fallback toPATH, unavailable handling, and invocation path passing.Testing
Ran
pytest tests/tools/test_piper_tts.py:Ran
pytest tests/tools/test_piper_routing_consolidation.py:Checklist
make test-contracts/make test) where applicable.