Search code examples
pythonwindowspyautogui

"cannot unpack non-iterable NoneType object" after Windows 11 update


I have an auto-click program to check my office attendance. However, this program do not work after Windows 11 update yesterday. The part of the program code and error message (not a full code) is below:

Program:

#!/usr/bin/env python
# coding: utf-8

# In[ ]:
import pyautogui
import time

# Find and Click ERP icon
pyautogui.doubleClick('erp.png')

# Find and Click Personal button
while True:
    try:
        pyautogui.click('personal.png')
        break
    except:
        time.sleep(0.1)

Error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
C:\Users\ADMINI~1\AppData\Local\Temp/ipykernel_11732/4182218478.py in <module>
      7 
      8 # Find and Click ERP icon
----> 9 pyautogui.doubleClick('erp.png')
     10 
     11 # Find and Click Personal button

Nothing is changed, including the filename and directory. I don't understand the reason for the error.


Solution

  • It works! The icon shape of the first png image file is changed due to Windows 11 update. I replaced the png file from the old to the new version, and it does not have any errors.