Update browser.py

This commit is contained in:
HibiKier 2021-07-11 15:16:52 +08:00 committed by GitHub
parent 2a6951426b
commit 558c836fe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ async def init(**kwargs) -> Optional[Browser]:
browser = await async_playwright().start()
_browser = await browser.chromium.launch(**kwargs)
return _browser
except NotImplemented:
except NotImplementedError:
logger.warning('win环境下 初始化playwright失败....请替换环境至linux')
return None
@ -47,13 +47,7 @@ def delete_pyppeteer():
dir = Path(AppDirs('pyppeteer').user_data_dir)
if not dir.exists():
return
# if not config.haruka_delete_pyppeteer:
# logger.info("检测到 Pyppeteer 依赖(约 300 M)"
# "新版 HarukaBot 已经不需要这些文件了。"
# "如果没有其他程序依赖 Pyppeteer请在 '.env.*' 中设置"
# " 'HARUKA_DELETE_PYPPETEER=True' 并重启 Bot 后,将自动清除残留")
# else:
shutil.rmtree(dir)
logger.info("已清理 Pyppeteer 依赖残留")