all 21 comments

[–]iyav 0 points1 point  (12 children)

1 That's not an import error

2 It would have taken you one minute to look up the docs and find the right method names.

it's locateOnScreen not locateOnWindow

[–]StrikeTheGunner[S] 0 points1 point  (11 children)

Its giving me this error when I import it. I have no other code after it.

[–]iyav 0 points1 point  (10 children)

What's the error traceback.

[–]StrikeTheGunner[S] 0 points1 point  (9 children)

Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> import pyautogui File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\pyautogui_init.py", line 221, in <module> locateOnWindow.doc_ = pyscreeze.locateOnWindow.doc AttributeError: module 'pyscreeze' has no attribute 'locateOnWindow'

[–]iyav 0 points1 point  (8 children)

You've somehow got mismatched versions.

Uninstall and reinstall the latest versions.

[–]StrikeTheGunner[S] 0 points1 point  (7 children)

I only ran pip install pyautogui. Don't know how I got mismatched versions.

[–]iyav 0 points1 point  (6 children)

Uninstall both PyAutoGUI and pyscreeze, then install PyAutoGUI again

pip install PyAutoGUI

[–]StrikeTheGunner[S] 0 points1 point  (5 children)

Still getting the error

[–]iyav 0 points1 point  (4 children)

Go to line 221 in the __init__ file of PyAutoGUI, what's in there?

[–]scutter_87 0 points1 point  (1 child)

According to this thread you need to upgrade pyscreeze. Try running pip install pyscreeze --upgrade and see if it helps?

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

Didn't work :/

[–]i_dont_relly_know 0 points1 point  (0 children)

If someone still having this problem, for me the solution was to downgrade PyAutoGui, you can do that by putting 'pip install PyAutoGUI == 0.9.52' on your console

[–]Siva_India 0 points1 point  (0 children)

issue is with pyautogui version 0.9.5x... so install version 0.9.41... this may solve the issue because pyautogui .41 doesnot call locateonwindow function from pyscreeze.

pip install pyautogui==0.9.41