ronnieotieno
ronnieotieno

Reputation: 144

Python gui(pyautogui) function throwing a type error, what could be the issue?

I cloned this repo and installed everything required. The program is to apply for jobs in linkedIn. Everything works perfectly until its time to apply for the job. Then I get the error which is in pyautogui functions, which I am not allowed to change. The error is:

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'

You can check the code by installing pyautogui.

Full stacktrace

Upvotes: 0

Views: 1179

Answers (1)

Devansh Soni
Devansh Soni

Reputation: 771

In the easyapplybot.py file of the repo you cloned, in line 294, modify avoid_lock(self) function like this:

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')

This error occurs because you can't pass None to moveTo() function of pyautogui. So, I've replaced None with pyautogui.position().y which the y-coordinate of position of cursor.

Hope this helps :)

Upvotes: 1

Related Questions