I have problems when using requests-html
package on Python 3.6.5, Ubuntu 16.04(x64). To be more specific, the last line of
from requests_html import HTMLSession
session = HTMLSession()
r = session.get('http://python-requests.org/')
r.html.render()
produces the following error:
Traceback (most recent call last): File "", line 1, in
File "/home/candy/.conda/envs/candy_env/lib/python3.6/site-packages/requests_html.py", line 572, in render self.session.browser # Automatycally create a event loop and browser
File "/home/candy/.conda/envs/candy_env/lib/python3.6/site-packages/requests_html.py", line 680, in browser self._browser = self.loop.run_until_complete(pyppeteer.launch(headless=True, args=['--no-sandbox']))
File "/home/candy/.conda/envs/candy_env/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete return future.result()
File "/home/candy/.conda/envs/candy_env/lib/python3.6/site-packages/pyppeteer/launcher.py", line 243, in launch return await Launcher(options, **kwargs).launch()
File "/home/candy/.conda/envs/candy_env/lib/python3.6/site-packages/pyppeteer/launcher.py", line 160, in launch self.browserWSEndpoint = self._get_ws_endpoint()
File "/home/candy/.conda/envs/candy_env/lib/python3.6/site-packages/pyppeteer/launcher.py", line 178, in _get_ws_endpoint raise BrowserError(f'Failed to connect to browser port: {url}')
pyppeteer.errors.BrowserError: Failed to connect to browser port: http://127.0.0.1:43623/json/version
However, the same code works well without errors on another Windows 10 platform, with the same Python requirements configured.
I have checked whether a Chrome has been downloaded successfully on my computer and the result is yes! So I think that's not where the problem is.
(candy_env) candy@botwriter01:~/.pyppeteer/local-chromium/543305/chrome-linux$ ls chrome chrome_sandbox libclearkeycdm.so locales nacl_helper_bootstrap natives_blob.bin resources.pak
xdg-mime chrome_100_percent.pak chrome-wrapper libEGL.so
MEIPreload nacl_helper_nonsfi product_logo_48.png swiftshader
xdg-settings chrome_200_percent.pak icudtl.dat libGLESv2.so
nacl_helper nacl_irt_x86_64.nexe resources
v8_context_snapshot.bin
I have already searched the guidebook of requests-html
for answers but got nothing found. I want the command r.html.render()
to work correctly, what can I do now?