vgalin / html2image

A package acting as a wrapper around the headless mode of existing web browsers to generate images from URLs and from HTML+CSS strings or files.
MIT License
354 stars 43 forks source link

Execution "subprocess.run" indefinitely #97

Open YuryRF opened 1 year ago

YuryRF commented 1 year ago

Using the Chrome browser. If the page uses javascript, then you need to wait until the script makes changes to the final html. We use the "--virtual-time-budget" flag. But it is with this flag that chrome hangs 1 out of 10 cases. subprocess.run(command) in chrome.py runs indefinitely. I used crutch like this: subprocess.run(command, check=True, timeout=5) and handled the error on exit from the "screenshot" function like this:

try:
    pass
except subprocess.TimeoutExpired:
    pass