fix(SU2_PY): improve Python wrapper reliability and remove invalid-escape warnings#2650
Merged
bigfooted merged 1 commit intosu2code:developfrom Dec 23, 2025
Merged
Conversation
- Avoid potential deadlocks by draining stderr with communicate() - Decode stderr with errors="replace" for robustness on Windows - Fix incorrect Path value in run_command failure message - Remove redundant SOLUTION_FILENAME assignment in parallel_computation_fsi - Use raw strings in OptimalPropeller plot labels to avoid invalid escape warnings Signed-off-by: shbhmexe <shubhushukla586@gmail.com>
pcarruscag
approved these changes
Dec 19, 2025
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.
Proposed Changes
This PR contains small, behavior-preserving fixes in SU2’s Python tooling:
SU2_PY/SU2/run/interface.py: makerun_command()safer and more reliable by usingcommunicate()to avoid stderr pipe deadlocks, improving stderr decoding robustness, and fixing a wrong “Path = …” diagnostic.SU2_PY/OptimalPropeller.py: use raw strings for matplotlib labels to avoid invalid escape sequence warnings and ensure LaTeX-like labels render correctly.SU2_PY/parallel_computation_fsi.py: remove a duplicated assignment in solution merge setup.Issues found and fixed (tool-related)
SU2_PY/SU2/run/interface.py–run_command()robustnesswait()+stderr.read()tocommunicate()(drains stderr while the process runs).errors="replace") to avoid wrapper crashes on non-UTF8 output (common on Windows).os.path.abspath(",")→os.path.abspath(".")).SU2_PY/OptimalPropeller.py– invalid escape sequence warningsSyntaxWarning: invalid escape sequenceand render as intended.SU2_PY/parallel_computation_fsi.py– redundant assignmentconfig.SOLUTION_FILENAME = config.RESTART_FILENAMEline (no behavior change, but prevents confusion and keeps merge setup consistent).Reasoning / Impact
Validation
python -m compileall SU2_PYsucceeds.