python - 尝试使用鼠标/导入时,出现递归错误/包操作失败
问题描述
我正在运行一个 python repl.it 环境/项目,我的代码如下所述:
from webbot import Browser
import time
from keyboard import press
import mouse
web = Browser()
tab = 1
add = 1
web.go_to('https://tankster.io')
time.sleep(7.5)
mouse.move(585, 335, absolute=True, duration=0.5)
mouse.click('left')
text_areas = web.find_elements(xpath='//input')
web.type(web.Key.ENTER,into=text_areas[0].text)
time.sleep(3)
global h
h = 100
while(h > 99):
press('enter')
time.sleep(5)
启动正常:
Repl.it:更新包配置
--> python3 -m 诗歌添加鼠标
对鼠标使用 ^0.7.1 版本
然后产生以下错误:
[RecursionError]
maximum recursion depth exceeded
exit status 1
Repl.it: Package operation failed.
我以前从未遇到过这样的错误,任何帮助将不胜感激!
解决方案
该mouse
模块需要linux 中的 root 访问权限,这对runner
(即 repl.it 用户)不可用。请参阅PyPI 描述或repo末尾的“已知限制mouse
”mouse
:
- 为了避免依赖于 X,Linux 部分读取原始设备文件 (
/dev/input/input*
),但这需要 root。
为了自动化 web UI 交互,我建议尝试使用 python 而不是和模块的Selenium web 驱动程序。这是有关如何使用的文档。webbot
mouse
推荐阅读
- android - Mac上的Android studio3.3.2错误“ADB服务器未确认,无法启动守护程序”
- c - accept4 中的声明 {sa_family=AF_UNIX} 和 [110->2] 是什么意思?
- python - 使用python或python pandas将多行行读入单行
- python - 尝试使用自制软件使用 python 安装 opencv 时出错?
- mysql - 如何改进SQL多次加入同一张表
- python - 无法使用 pyspark 将 Xml 数据读取到数据帧
- python - 如何以矢量化方式将矩形边界转换为数组切片?
- c# - 策略以及如何在 .net core 3.0 中间件中创建请求和响应管道
- angularjs - 如何异步调用 Square API 方法
- java - Java - 超类的 instanceof