-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix: Fix ManagedBrowser constructor and Windows encoding issues #1238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This commit fixes two critical issues in the CLI browser management: 1. **ManagedBrowser Constructor Error**: Fixed 'NoneType' object has no attribute 'browser_type' error - Updated BrowserProfiler.launch_builtin_browser() and launch_standalone_browser() methods - Now properly creates BrowserConfig objects before passing to ManagedBrowser constructor - Resolves issue where ManagedBrowser expected browser_config parameter but received individual parameters 2. **Windows Encoding Error**: Fixed 'gbk' codec can't encode character '\u2139' error - Replaced Unicode info symbol (ℹ) with ASCII-compatible 'i' in async_logger.py and utils.py - Ensures compatibility with Windows command prompt and various terminal encodings - Maintains functionality while improving cross-platform compatibility **Files Changed:** - crawl4ai/browser_profiler.py: Updated ManagedBrowser instantiation - crawl4ai/async_logger.py: Replaced Unicode symbols with ASCII - crawl4ai/utils.py: Replaced Unicode symbols with ASCII **Testing:** - Verified 'crwl browser start/stop/status' commands work correctly - Tested basic crawling functionality with various output formats - Confirmed fixes work on Windows WSL environment Fixes issues preventing users from using browser management CLI commands on Windows systems.
WalkthroughThe changes update log and message icons from the Unicode "ℹ" to the ASCII "i" in both logging and utility message functions. Additionally, browser instantiation is refactored to use a Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant BrowserProfiler
participant BrowserConfig
participant ManagedBrowser
Caller->>BrowserProfiler: launch_standalone_browser/launch_builtin_browser()
BrowserProfiler->>BrowserConfig: Create config with params
BrowserProfiler->>ManagedBrowser: Instantiate with BrowserConfig and logger
ManagedBrowser-->>BrowserProfiler: ManagedBrowser instance
BrowserProfiler-->>Caller: Return ManagedBrowser instance
Assessment against linked issues
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🔇 Additional comments (5)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This commit fixes two critical issues in the CLI browser management:
ManagedBrowser Constructor Error: Fixed 'NoneType' object has no attribute 'browser_type' error
Windows Encoding Error: Fixed 'gbk' codec can't encode character '\u2139' error
Files Changed:
Testing:
Fixes issues preventing users from using browser management CLI commands on Windows systems.
Summary
Please include a summary of the change and/or which issues are fixed.
eg:
Fixes #123
(Tag GitHub issue numbers in this format, so it automatically links the issues with your PR)List of files changed and why
eg: quickstart.py - To update the example as per new changes
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist:
Summary by CodeRabbit
Style
Refactor