Fix build book script#230
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes issues with the build book script, specifically addressing Unicode decoding errors during subprocess execution and improving LaTeX document formatting.
Key Changes:
- Enhanced error handling in
run_command()function with dynamic encoding detection and tolerant error handling - Added LaTeX packages and configurations to improve document layout and URL handling
- Reorganized import statements for better code structure
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scripts/build_book.py | Fixed Unicode decoding errors by implementing dynamic encoding detection, adding proper error handlers, and improving output streaming with try-finally block |
| src/main.tex | Added LaTeX packages (microtype, xurl, etoolbox) and configurations to fix headheight warnings, improve typography, and handle long URLs in bibliography |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| encoding=encoding, | ||
| errors="replace", # or "backslashreplace" if you want to see the bytes escaped | ||
| bufsize=1, # line-buffered (best effort) | ||
| universal_newlines=True, |
There was a problem hiding this comment.
The parameters text=True (line 53) and universal_newlines=True (line 57) are redundant. Both parameters do the same thing - they enable text mode for subprocess output. In Python 3.7+, text is the preferred parameter name, while universal_newlines is the legacy alias. Only one should be specified to avoid confusion and redundancy.
| universal_newlines=True, |
No description provided.