Fix Windows compatibility for Math Animator renderer#256
Merged
Fix Windows compatibility for Math Animator renderer#256
Conversation
This PR fixes multiple Windows compatibility issues that prevented the Math Animator from generating videos on Windows systems. ### Changes 1. **renderer.py**: Fix subprocess execution on Windows - Replace `asyncio.create_subprocess_exec` with `subprocess.run` + `asyncio.to_thread` - The original approach silently fails on Windows when uvicorn uses SelectorEventLoop (default) - New approach works regardless of event loop type 2. **code_generator_agent.yaml (en/zh)**: Add Manim v0.20.1 compatibility constraints - Prohibit `MarkupText` (requires LaTeX) - Prohibit `stroke_dash_pattern` parameter (not supported in v0.20.1) - Prohibit `save_state()` method (not supported in MovingCameraScene) - Applied to both `generate_system` and `retry_system` sections 3. **ChatComposer.tsx**: Suppress hydration warning for i18n placeholder - Add `suppressHydrationWarning` to textarea - Resolves SSR/CSR text mismatch warning for language-specific placeholders ### Testing - ✅ CLI mode: Successfully generated Pythagorean theorem animation (660KB) - ✅ Web mode: Successfully generated cone cross-section animation - ✅ Auto-retry: First attempt error → LLM repair → second attempt success Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
e872a90 to
7b55f11
Compare
…back Instead of replacing asyncio.create_subprocess_exec with subprocess.run (which loses real-time streaming and cancellation), fix the root cause: set WindowsProactorEventLoopPolicy before uvicorn starts so that create_subprocess_exec works correctly on Windows. This preserves the original async streaming renderer while fixing Windows compatibility at the event loop level. Made-with: Cursor
Collaborator
|
Thanks for your contribution! |
4 tasks
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.
Problem
Math Animator failed silently on Windows with no error messages. The renderer would reach "Launching Manim scene" and immediately exit with empty error content.
Root cause:
asyncio.create_subprocess_execis incompatible with Windows SelectorEventLoop (uvicorn's default), causing silent subprocess creation failures.Solution
1. Fix subprocess execution (
renderer.py)asyncio.create_subprocess_execwithsubprocess.run+asyncio.to_thread2. Add Manim v0.20.1 compatibility constraints (prompts)
MarkupText- Requires LaTeX compilationstroke_dash_pattern- Removed in v0.20.1save_state()- Not supported in MovingCameraScene3. Fix i18n hydration warning (
ChatComposer.tsx)suppressHydrationWarningto textarea placeholderTesting
Before
After
Screenshots
Successfully generated on Windows:
Impact
Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com