I am using a python module that uses playwright in my heroku flask app. The installation instructions for the module require that I install the browser binaries like:
python -m playwright install
While when I deploy it locally it works, I seem unable to incorporate the browser binary installation in the deployment. I have tried to use the heroku playwright buildpack instead ( https://github.com/mxschmitt/heroku-playwright-buildpack ), but this doesn't seem to work, and I get an error like:
2020-11-17T23:06:42.252585+00:00 app[web.1]: "webkit" browser was not found.
2020-11-17T23:06:42.252585+00:00 app[web.1]: Please complete Playwright installation via running
2020-11-17T23:06:42.252585+00:00 app[web.1]:
2020-11-17T23:06:42.252586+00:00 app[web.1]: "python -m playwright install"
I also tried manually adding the python -m playwright install command in a buildpack, but this does not work either. Is there any way to install the binaries properly using playwright in heroku?
Heroku当时不支持webkit,其他浏览器可以使用这个buildpack: https ://github.com/mxschmitt/heroku-playwright-buildpack/
What worked for me as a workaround, and I am 100% sure it is not the right solution is to add this to my python code:
from subprocess import Popen, PIPE
p = Popen([sys.executable, "-m", "playwright", "install"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
#output, err = p.communicate()
#print(output)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.