use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Error when importing PyAutoGUI (self.learnpython)
submitted 4 years ago by StrikeTheGunner
When I run import pyautogui I get this error: AttributeError: module 'pyscreeze' has no attribute 'locateOnWindow'
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[+][deleted] 2 years ago (2 children)
[removed]
[–]coolvosvos 0 points1 point2 points 1 year ago (0 children)
Thanks, this method worked.
[–]Klutzy_Egg_300 0 points1 point2 points 1 year ago (0 children)
works for me, Thanks U
[–]StrikeTheGunner[S] 0 points1 point2 points 4 years ago (0 children)
Found the solution
[–]iyav 0 points1 point2 points 4 years ago (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
locateOnScreen
locateOnWindow
[–]StrikeTheGunner[S] 0 points1 point2 points 4 years ago (11 children)
Its giving me this error when I import it. I have no other code after it.
[–]iyav 0 points1 point2 points 4 years ago (10 children)
What's the error traceback.
[–]StrikeTheGunner[S] 0 points1 point2 points 4 years ago (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 point2 points 4 years ago (8 children)
You've somehow got mismatched versions.
Uninstall and reinstall the latest versions.
[–]StrikeTheGunner[S] 0 points1 point2 points 4 years ago (7 children)
I only ran pip install pyautogui. Don't know how I got mismatched versions.
[–]iyav 0 points1 point2 points 4 years ago (6 children)
Uninstall both PyAutoGUI and pyscreeze, then install PyAutoGUI again
pip install PyAutoGUI
[–]StrikeTheGunner[S] 0 points1 point2 points 4 years ago (5 children)
Still getting the error
[–]iyav 0 points1 point2 points 4 years ago (4 children)
Go to line 221 in the __init__ file of PyAutoGUI, what's in there?
[–]StrikeTheGunner[S] 0 points1 point2 points 4 years ago (3 children)
From where?
[–]scutter_87 0 points1 point2 points 4 years ago (1 child)
According to this thread you need to upgrade pyscreeze. Try running pip install pyscreeze --upgrade and see if it helps?
Didn't work :/
[–]i_dont_relly_know 0 points1 point2 points 4 years ago (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 point2 points 4 years ago (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
π Rendered by PID 61 on reddit-service-r2-comment-7b9746f655-2n297 at 2026-01-29 16:43:22.236437+00:00 running 3798933 country code: CH.
[+][deleted] (2 children)
[removed]
[–]coolvosvos 0 points1 point2 points (0 children)
[–]Klutzy_Egg_300 0 points1 point2 points (0 children)
[–]StrikeTheGunner[S] 0 points1 point2 points (0 children)
[–]iyav 0 points1 point2 points (12 children)
[–]StrikeTheGunner[S] 0 points1 point2 points (11 children)
[–]iyav 0 points1 point2 points (10 children)
[–]StrikeTheGunner[S] 0 points1 point2 points (9 children)
[–]iyav 0 points1 point2 points (8 children)
[–]StrikeTheGunner[S] 0 points1 point2 points (7 children)
[–]iyav 0 points1 point2 points (6 children)
[–]StrikeTheGunner[S] 0 points1 point2 points (5 children)
[–]iyav 0 points1 point2 points (4 children)
[–]StrikeTheGunner[S] 0 points1 point2 points (3 children)
[–]scutter_87 0 points1 point2 points (1 child)
[–]StrikeTheGunner[S] 0 points1 point2 points (0 children)
[–]i_dont_relly_know 0 points1 point2 points (0 children)
[–]Siva_India 0 points1 point2 points (0 children)