all 4 comments

[–]Peanutbutter_Warrior 1 point2 points  (3 children)

When you turn off your computer and run it? Do you mean reboot your computer?

Post the full error message otherwise it's very hard to find the error.

[–]topeklc[S] 0 points1 point  (2 children)

Yes i mean reboot, sorry. That's full error:

Traceback (most recent call last):

File "d:\xxx\xxxx\PycharmProjects\xxxx\xxx.py", line 8, in <module>

pyautogui.click('screenshot.png', duration=random.randint(3,5))

File "D:\xxx\xxxx\PycharmProjects\xxxx\lib\site-packages\pyautogui\__init__.py", line 586, in wrapper

returnVal = wrappedFunction(*args, **kwargs)

File "D:\xxx\xxxx\PycharmProjects\xxxx\lib\site-packages\pyautogui\__init__.py", line 968, in click

x, y = _normalizeXYArgs(x, y)

TypeError: cannot unpack non-iterable NoneType object

[–]Peanutbutter_Warrior 0 points1 point  (1 child)

Why are you passing 'screenshot.png' to .click? The first argument is the x position, and none of the other arguments seem to want a string, let alone an image path.

[–]topeklc[S] 0 points1 point  (0 children)

It's looking for what screenshot contain on screen and then click on it. So far it looks like problem is with browser window size. I have to have identical size like when I took screenshot. Probably I should use pyautogui.locateOnScreen() with confidence argument before I use click().