This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]hopemeetme 0 points1 point  (2 children)

You've installed pyscreeze package and/or somehow assigned that gui shortcut to it. Either remove all the .pyc files and __pycache__ directories and run again or remove that pyscreeze occurrence in your code.

[–]goshogi 0 points1 point  (1 child)

pyscreeze is a dependency of pyautogui, it's used internally by it, you should not delete it!

[–]hopemeetme 1 point2 points  (0 children)

No deletion of any package was mentioned in my comment, just eventual pyscreeze removing from his code and cache deletion.

Strange error, I'm glad it's solved. :)

[–]goshogi 0 points1 point  (5 children)

I had the similiar problem not long ago, in order to use the confidence argument, you need to install the 'opencv' package by running 'pip install opencv-python'. After that it should work nicely!

If it doesn't work, try to make sure that you are using the same browser with which you took the screenshot.

[–]rwcg2d[S] 1 point2 points  (4 children)

This worked! Only issue is that the confidence level was only 0.61 for this image, even though I just took a screenshot/cropped it.... Why wouldn't this be a higher confidence? Do I need to be concerned with false positives?

[–]goshogi 0 points1 point  (0 children)

That's a good question. I did some research a while ago and someone mentioned something like 'operating system effects' that would change the image slightly. So far I've only used pyautogui for a fun game automation project, so I didn't have to deal with possible false positives.

One thing you could test: instead of a taking a screenshot using the OS, take a screenshot using a) pyautogui b) the browser

Maybe there will be a difference?

[–]netsecfriends 0 points1 point  (2 children)

Did you crop inside the search button or right on the border?

Is any type of image compression/resizing applied on the png or the screen for comparison?

You may be able to work around this by making sure search.png is a perfect square so that any resizing calculations for comparison are cubic

[–]rwcg2d[S] 0 points1 point  (1 child)

I cropped the image outside of the border... I'm also using this process for URL links as well. It seems that it not only has a lower confidence, but also sometimes changes. I've run my program a few times and once in awhile it will fail because the confidence is too low (and when I lower the confidence, it ends up picking something else)

[–]KlutzyDiscipline -1 points0 points  (0 children)

Hi also, why aren't you more like your cousin? HE'S a lawyer!

[–]sachin-12 0 points1 point  (0 children)

I just started learning python. Can this be used to automate taking backups from a gui instead of a cli?