当前位置: 首页 > news >正文

公司网站制作应该注意些什么免费的推广引流软件下载

公司网站制作应该注意些什么,免费的推广引流软件下载,手袋 技术支持 东莞网站建设,做网站最小的字体是多少近期因个人需要接触playwright,由于playwright新接触,想用jupyter进行API测试学习。刚开始使用sync_playwright,在playwright的Conda运行环境中,以console模式和单文件直接运行模式,都能正常运行。但是进入jupyter中后…

    近期因个人需要接触playwright,由于playwright新接触,想用jupyter进行API测试学习。刚开始使用sync_playwright,在playwright的Conda运行环境中,以console模式和单文件直接运行模式,都能正常运行。但是进入jupyter中后,sync_playwright就无法运行了。会出现如下提示:

Error: It looks like you are using Playwright Sync API inside the asyncio loop.
Please use the Async API instead.

在网上找到(如何在 Jupyter 笔记本中使用 Playwright 库而不是使用常规 .py 脚本(在 Windows 上) - python - SO中文参考 - www.soinside.com)这篇文章,才知道“Jupyter Notebook 使用 asyncio 事件循环,因此您应该使用 async api”。

于是将sync_playwright改成 async_playwright。然后又面临上述文章中的同样问题。

Not Implemented error

按照上述文章所说,更改jupyter核心运行库:

1、导航到 Python 目录中的 Lib/site-packages/ipykernel/kernelapp.py

2、将该文件中的一行代码注释掉

if sys.platform.startswith("win") and sys.version_info >= (3, 8):import asynciotry:from asyncio import WindowsProactorEventLoopPolicy, WindowsSelectorEventLoopPolicyexcept ImportError:pass# not affectedelse:if type(asyncio.get_event_loop_policy()) is WindowsProactorEventLoopPolicy:# WindowsProactorEventLoopPolicy is not compatible with tornado 6# fallback to the pre-3.8 default of Selector# 注释掉此行:asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())print(f'do not change to Selector Event Loop') #加入一行提示

则下述代码运行通过:

from playwright.async_api import async_playwrightplaywright = await async_playwright().start()
browser = await playwright.chromium.launch(headless = False,)c=await browser.new_context(viewport={'width':1024,'height':768})page = await c.new_page()await page.goto("http://image.baidu.com")await page.locator("#kw").fill("XXX...")await page.locator("#homeSearchForm > span.s_btn_wr > input").click()async with  page.expect_popup() as page1_info:await page.locator("#imgid > div > ul > li:nth-child(6)").click()
page1 = await page1_info.valueawait browser.close()
await playwright.stop()

此问题产生的原因,在这篇文章中有所描述:(Running Playwright in JupyterLab Notebook Problem - Not implemented Error - #2 by fomightez - JupyterLab - Jupyter Community Forum)

It appears that the problem is specific to Windows Platform and as identified in the original question as the use of SelectorEventLoopPolicy rather than ProactorEventloopPolicy in JupyterLabs is the source of the issue.

Since SelectorEventLoopPolicy does not support Pipes the Not implemented error occurs when Playwright first tries to open a pipe. 

...

#asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())

Comment out that line,

Not sure if this will have any adverse effects on other operations, but it does cause the original code to execute in JupyterLab.

似乎这个问题是特定于Windows平台的,并且在原始问题中确定为在JupyterLabs中使用SelectorEventLoopPolicy而不是ProactorEventloopPolicy是问题的根源。

由于SelectorEventLoopPolicy不支持管道,当playwright第一次尝试打开管道时,会出现not implemented错误。

#asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())

注释掉这行代码,

不确定这是否会对其他操作产生任何不利影响,但它确实会导致原始代码在JupyterLab中执行。

目前microsoft在github playwright的bug回复里,这个问题并没有得到解决。所以这只能是一时之选。

http://www.tj-hxxt.cn/news/94909.html

相关文章:

  • 男女做暧昧试看网站免费个人网站建站
  • 正规的合肥网站建设成都排名推广
  • 做的比较好的企业网站互联网公司
  • 荆州大气网站建设价格如何在百度推广自己的产品
  • 长春网站制作价格口碑营销策略
  • 做网站济南西找网站设计公司
  • 广州企业网站设计制作网站搭建关键词排名
  • 网站销售策划可免费投放广告的平台
  • 高埗镇仿做网站真正免费建站
  • 毕业设计网站用什么做站长是什么级别
  • 佛山做外贸网站网络营销主要有哪些特点
  • 用符号做照片的网站上海seo博客
  • 如何 做网站挣钱app营销策略都有哪些
  • 移动端网站搭建百度云盘登录电脑版
  • 淘宝运营可以自学吗优化建站
  • 邹城有做网站的吗优化师是干嘛的
  • 惠州惠城区建设网站什么是网络营销策略
  • 在线网站建设windows优化工具
  • 网站管理在百度平台如何做营销
  • 高新建设网站电话百度seo优化排名如何
  • 惠民网站建设nba最新交易消息
  • 全国网站建设百度客户服务电话是多少
  • 电影网站app怎么做网站及推广
  • 网站第三方评价如何做网站关键词优化的步骤和过程
  • 从学习php到可以独立做网站需要多久企业培训课程价格
  • 做网站如何防止被抄袭排名查询系统
  • 权威发布e站免费b站推广网站短视频
  • 郑州动力无限网站建设seo网络优化是什么工作
  • 苏州专业做网站公司电话小红书sem是什么意思
  • 深圳网站开发制作什么是搜索引擎优化的核心