Python Gui(pyautogui)函数抛出类型错误,可能是什么问题?

2024-05-03 19:03:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我克隆了这个repo并安装了所有需要的东西。该计划旨在申请linkedIn的工作。在申请这份工作之前,一切都很顺利。然后我得到pyautogui函数中的错误,我不允许更改它。错误是:

File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\pyautogui__init__.py", line 691, in _normalizeXYArgs

return Point(int(firstArg), int(secondArg)) # firstArg and secondArg are just x and y number values

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

您可以通过安装pyautogui来检查代码

Full stacktrace


Tags: and函数number错误repousersappdata计划
1条回答
网友
1楼 · 发布于 2024-05-03 19:03:44

在您克隆的repo的easyapplybot.py文件的第294行中,修改avoid_lock(self)函数如下:

def avoid_lock(self):
        x, _ = pyautogui.position()
        pyautogui.moveTo(x+200, pyautogui.position().y, duration=1.0)
        pyautogui.moveTo(x, pyautogui.position().y, duration=0.5)
        pyautogui.keyDown('ctrl')
        pyautogui.press('esc')
        pyautogui.keyUp('ctrl')
        time.sleep(0.5)
        pyautogui.press('esc')

发生此错误是因为无法将None传递给pyautoguimoveTo()函数。因此,我将None替换为pyautogui.position().y,它是光标位置的y坐标

希望这有帮助:)

相关问题 更多 >