-
Notifications
You must be signed in to change notification settings - Fork 232
fix headless rendering with latest chrome #361
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: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,7 +49,20 @@ def _screenshot_data( | |
| # else: | ||
| # assert isinstance(fig, ipv.Figure) | ||
|
|
||
| chrome = PyChromeDevTools.ChromeInterface(headless_kwargs) | ||
|
|
||
| try: | ||
| host = "localhost" | ||
| port = 9222 | ||
|
|
||
| if headless_kwargs.get("host"): | ||
| host = headless_kwargs.get("host") | ||
|
|
||
| chrome = PyChromeDevTools.ChromeInterface(host=host, port=port) | ||
| #chrome = PyChromeDevTools.ChromeInterface(host="localhost") | ||
rafique marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| except: | ||
| print("Falied to connect to headless chrome, please make sure it's running on host={} and port={}".format(host, port)) | ||
| raise | ||
|
|
||
| chrome.Network.enable() | ||
| chrome.Page.enable() | ||
| chrome.Page.navigate(url=html_filename) | ||
|
|
@@ -59,16 +72,19 @@ def _screenshot_data( | |
| result = chrome.Runtime.evaluate(expression='ipvss()') | ||
| tries = 0 | ||
| while tries < 10: | ||
| #print(str(result)) | ||
| try: | ||
| url = result['result']['result']['value'] | ||
| url = result[0]['result']['result']['value'] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why did this change, and which version, and can we make it detect this? so it also works on older versions?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I don't know why/when this has changed. This seems to work fine but recently throwing the following error: "tuple indices must be integers or slices, not str". This is the main reason prompting this pull request. Since there has been no recent update to ipyvolume python module, my guess is that something else (chrome/ipyvolume js module/threejs) has been updated |
||
| return url | ||
| except: | ||
| if 'ipvss' in result['result']['result']['description']: | ||
| except Exception as ex: | ||
| #print(str(ex)) | ||
| #raise ex | ||
rafique marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if 'ipvss' in result[0]['result']['result']['description']: | ||
rafique marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| tries += 1 | ||
| time.sleep(0.5) | ||
| else: | ||
| print('error getting result, return value was:', result) | ||
| raise | ||
| raise ex | ||
rafique marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| def _main(): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.