Skip to content
Advertisement

pyautogui throws me error message. How can I fix my code?

It gives me error message like below. How can I fix this?

JavaScript

I made a code as below. I think that if x.size == 0: is the problem.

JavaScript

When I do print(x), I get the same error message.

Advertisement

Answer

This was changed in version 0.9.41. After that point, if the window is not found, it raises an exception. Before that point, it returns None. So, you need:

JavaScript

If you upgrade, you will have to add exception handling for this case.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement