解決方案:puppeteer在初始化launch時,必須增加以下的參數【handleSIGINT=False, handleSIGTERM=False, handleSIGHUP=False】才能使得flask的run-debug模式啓動也能正常運行!
puppeteer官方文檔:https://miyakogi.github.io/pyppeteer/reference.html#launcher
_browser = await launch( { "headless": _headless, "defaultViewport": _defaultViewport, "args": _args, "handleSIGINT": False, "handleSIGTERM": False, "handleSIGHUP": False })
解決方案的思路來源:
1、https://xbuba.com/questions/53679905
2、https://stackoom.com/question/3dEav/%E5%9C%A8FLASK%E4%B8%AD%E8%BF%90%E8%A1%8Cpypupeteer%E4%BC%9A%E4%BA%A7%E7%94%9FValueError-%E4%BF%A1%E5%8F%B7%E4%BB%85%E5%9C%A8%E4%B8%BB%E7%BA%BF%E7%A8%8B%E4%B8%AD%E6%9C%89%E6%95%88
轉自:https://blog.csdn.net/weixin_43343144/article/details/110203479