Am using the pyautogui module now from Automate the Boring Stuff With Python. My code keeps telling me pyscreeze has no attribute locateOnWindow

Viewed 4699
import pyautogui
wh = pyautogui.size()
print(wh)

output:

locateOnWindow.__doc__ = pyscreeze.locateOnWindow.__doc__
AttributeError: module 'pyscreeze' has no attribute 'locateOnWindow'

Please I will be grateful for your Help.

5 Answers

I deleted pyautogui and pyscreeze, then it worked for me.

To delete First locate where pyautogui is installed. Use this command to locate pyautogui on your machine:

 pip show pyautogui

Then copy location.

My location was:

c:\users\nitro 5\appdata\local\programs\python\python38\lib\site-packages

Delete Pyautogui and pyscreeze.

Install pyautogui:

pip install pyautogui

I have also had the exact same issue. All that I really had to do was to install the newer version of the Pyscreeze library. As you can see from this link https://github.com/asweigart/pyscreeze/commit/9edb5d70fbe3b3ee2f2cb710f25401b893d51dfc they've added the locateOnWindow() function in the version of 0.1.27. As for my part, I'd had the Pyscreeze of 0.1.26 version. After I'd had installed the newer version of the library everything started working just fine.

I had the same problem and solved it with this method

pip install --upgrade pyscreeze 
Related