question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting AttributeError: module 'pyscreeze' has no attribute 'locateOnWindow' on import

See original GitHub issue

When attempting import pyautogui, I get the following error message and traceback:

Traceback (most recent call last):

  File "<ipython-input-1-fa2587ca3a04>", line 1, in <module>
    import pyautogui

  File "/usr/lib/python3.9/site-packages/pyautogui/__init__.py", line 221, in <module>
    locateOnWindow.__doc__ = pyscreeze.locateOnWindow.__doc__

AttributeError: module 'pyscreeze' has no attribute 'locateOnWindow'

I have checked the contents of pyscreeze/__init__.py, not just on my computer, but as it currently appears in the pyscreeze repository as well, and there really is no locateOnWindow function/class/etc. contained in it.

The problem might have been introduced by this commit about 2-3 months ago. Strangely, however, I have not been able to find anyone else on the web experiencing it.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:9
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

35reactions
JayRizzocommented, Jul 19, 2021

Hi Everyone! I hope everyone is doing well. It looks like there is an easy fix for this one.

https://github.com/asweigart/pyautogui/blob/5e4acb870f2e7ce0ea1927cc5188bc2f5ab7bbbc/pyautogui/__init__.py#L221

Here on this line we just need to change

locateOnWindow.__doc__ = pyscreeze.locateOnWindow.__doc__

To This:

locateOnWindow.__doc__ = pyscreeze.locateOnScreen.__doc__

Update this and your inputs will work. The locateOnWindow changed to locateOnScreen.

++@asweigart, FYI

Tested on: Windows Version	10.0.19042 Build 19042
Current Python:        3.9.2
Current PyAutoGUI:     0.9.53

The file location for me was: ‘C:\Users\{UserName}\AppData\Roaming\Python\Python39\site-packages\pyautogui\init.py’

Do not look in the C:\Program Files\Python39 folders

2reactions
abuzzecommented, Mar 3, 2022

You should update pyscreeze to at least 0.1.28. to fix this error.

pip3 install pyscreeze -U

Read more comments on GitHub >

github_iconTop Results From Across the Web

Am using the pyautogui module now from Automate the ...
Am using the pyautogui module now from Automate the Boring Stuff With Python. My code keeps telling me pyscreeze has no attribute locateOnWindow....
Read more >
Error when importing PyAutoGUI : r/learnpython - Reddit
When I run import pyautogui I get this error: AttributeError: module 'pyscreeze' has no attribute 'locateOnWindow'
Read more >
PyScreeze - PyPI
PyScreeze is a simple, cross-platform screenshot module for Python 2 and 3. About. PyScreeze can take screenshots, save them to files, and locate...
Read more >
A brand new website interface for an even better experience!
Getting AttributeError : module 'pyscreeze' has no attribute 'locateOnWindow' on import.
Read more >
module 'pyscreeze' has no attribute 'locateOnWindow'
pyautogui AttributeError: module 'pyscreeze' has no attribute ... When attempting import pyautogui, I get the following error message and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found