Skip to content
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

pyppeteer.errors.BrowserError: Browser closed unexpectedly: #46

Closed
Rease123 opened this issue Aug 1, 2020 · 5 comments
Closed

pyppeteer.errors.BrowserError: Browser closed unexpectedly: #46

Rease123 opened this issue Aug 1, 2020 · 5 comments

Comments

@Rease123
Copy link

Rease123 commented Aug 1, 2020

When I run a html file using "snapshot render.html svg", what are the some errors ? How to resovle it?

Generating file ...
Traceback (most recent call last):
File "/usr/local/bin/snapshot", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/pyecharts_snapshot/main.py", line 86, in main
asyncio.get_event_loop().run_until_complete(_main())
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
return future.result()
File "/usr/local/lib/python3.7/site-packages/pyecharts_snapshot/main.py", line 109, in _main
file_name, output, delay=delay, pixel_ratio=pixel_ratio
File "/usr/local/lib/python3.7/site-packages/pyecharts_snapshot/main.py", line 130, in make_a_snapshot
file_name, file_type, pixel_ratio, delay
File "/usr/local/lib/python3.7/site-packages/pyecharts_snapshot/main.py", line 169, in async_make_snapshot
return await get_echarts(to_file_uri(html_path), snapshot_js)
File "/usr/local/lib/python3.7/site-packages/pyecharts_snapshot/main.py", line 173, in get_echarts
browser = await launch()
File "/usr/local/lib/python3.7/site-packages/pyppeteer/launcher.py", line 305, in launch
return await Launcher(options, **kwargs).launch()
File "/usr/local/lib/python3.7/site-packages/pyppeteer/launcher.py", line 166, in launch
self.browserWSEndpoint = get_ws_endpoint(self.url)
File "/usr/local/lib/python3.7/site-packages/pyppeteer/launcher.py", line 225, in get_ws_endpoint
raise BrowserError('Browser closed unexpectedly:\n')
pyppeteer.errors.BrowserError: Browser closed unexpectedly:

@sunhailin-Leo
Copy link
Member

@Rease123

  • Are you running at Linux?
  • If you are running at Linux, you should change the source code for await pyppeteer.launch(options={'args': ['--no-sandbox']})

@vsoch
Copy link

vsoch commented Mar 26, 2022

Hi! I just hit this issue (on Linux) - when you say "change the source code" could you point me to where this is?

@vsoch
Copy link

vsoch commented Mar 26, 2022

I suspect here?

async def get_echarts(url: str, snapshot_js: str):
browser = await launch()
page = await browser.newPage()
await page.goto(url)
content = await page.evaluate(snapshot_js)
await browser.close()
return content

Would you accept a pull request to add a command line argument for --no-sandbox? I think there are likely a lot of Linux users (and this would be useful for them too!)

@ZongzhiWu
Copy link

@vsoch Have you solved this problem on linux?

@vsoch
Copy link

vsoch commented Dec 13, 2022

I didn't pursue it further because there was no response above, and wound up using plotly in Python with some html templates and it produced the chart I was looking for. https://github.com/vsoch/citelang/blob/5b0fe38553afd90b19bfe918ca7b5ea56d5b513d/citelang/main/badge/__init__.py#L9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants