【问题标题】:When trying to use mouse / import, I'm getting a recursion error / package operation fail尝试使用鼠标/导入时,出现递归错误/包操作失败
【发布时间】:2021-07-15 18:22:41
【问题描述】:

我正在运行一个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.

我从来没有遇到过这样的错误,任何帮助将不胜感激!

【问题讨论】:

    标签: python python-3.x repl.it


    【解决方案1】:

    mouse 模块需要root access in linuxwhich is not available to the runner (i.e., the repl.it user)。见the mouse PyPI descriptionthe mouse repo末尾的“已知限制”:

    • 为避免依赖 X,Linux 部分读取原始设备文件 (/dev/input/input*),但这需要 root。

    为了自动化 Web UI 交互,我推荐使用 python 的trying Selenium web drivers 而不是webbotmouse 模块。 Here 是关于如何使用的文档。

    【讨论】:

    • Selenium 很难在 repl.it 中配置...我已经成功过一次(很久以前),但它不再有效。在这方面有什么建议吗?
    猜你喜欢
    • 2017-01-10
    • 1970-01-01
    • 2020-11-14
    • 1970-01-01
    • 2018-04-14
    • 1970-01-01
    • 2015-12-27
    • 2022-08-08
    • 1970-01-01
    相关资源
    最近更新 更多