diff --git a/README.md b/README.md index 5faf5d9de..5e67483d6 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ # Step 3: Clone the repository to your local machine, and install it. - **Install the Required Browsers** - to support PDF conversion, had better install Chrominum. + to support PDF conversion, please install Chrominum. ```bash playwright install --with-deps chromium @@ -114,18 +114,20 @@ # Step 3: Clone the repository to your local machine, and install it. pip install pyppeteer ``` - - **Install the Required Browsers** + - **Use your own Browsers** - ```bash - pyppeteer-install - ``` - - pyppeteer alow you use already installed browsers, if you do not want to run the above command, please set the following envirment + pyppeteer alow you use installed browsers, please set the following envirment ```bash export PUPPETEER_EXECUTABLE_PATH = /path/to/your/chromium or edge or chrome ``` + please do not use this command to install browser, it is too old + + ```bash + pyppeteer-install + ``` + - **modify `config.yaml`** uncomment MERMAID_ENGINE from config.yaml and change it to `pyppeteer` diff --git a/metagpt/utils/common.py b/metagpt/utils/common.py index 99038dc64..5f94de066 100644 --- a/metagpt/utils/common.py +++ b/metagpt/utils/common.py @@ -192,6 +192,7 @@ class CodeParser: logger.error(f"{pattern} not match following text:") logger.error(text) # raise Exception + return "" return code @classmethod diff --git a/metagpt/utils/mmdc_pyppeteer.py b/metagpt/utils/mmdc_pyppeteer.py index e6986bc76..f3e00d053 100644 --- a/metagpt/utils/mmdc_pyppeteer.py +++ b/metagpt/utils/mmdc_pyppeteer.py @@ -34,10 +34,15 @@ def mermaid_to_file(mermaid_code, output_file_without_suffix, width, height): async def mermaid_to_file0(mermaid_code, output_file_without_suffix, width=2048, height=2048, suffixes=['png', 'svg', 'pdf'])-> int: __dirname = os.path.dirname(os.path.abspath(__file__)) - browser = await launch(headless=True, - executablePath=os.getenv('PUPPETEER_EXECUTABLE_PATH',"/opt/homebrew/bin/chromium"), - args=['--disable-extensions',"--no-sandbox"] - ) + executablePath = os.getenv('PUPPETEER_EXECUTABLE_PATH',"") + if executablePath: + browser = await launch(headless=True, + executablePath=executablePath, + args=['--disable-extensions',"--no-sandbox"] + ) + else: + print("Please set the environment variable:PUPPETEER_EXECUTABLE_PATH.") + return -1 page = await browser.newPage() device_scale_factor = 1.0