Python Forum
Cannot unpack non-iterable NoneType object, i would like to ask for help on this.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot unpack non-iterable NoneType object, i would like to ask for help on this.
#1
Hello dear Forum users,
I am currently learning about Pythons Image Recognision and I have encountered this error.
After looking it up online I still cant figure my case out, so I would like to ask for your help on this.

import pyautogui
import keyboard
from time import sleep

while keyboard.is_pressed('m') == False:
    if  pyautogui.locateOnScreen(r'C:\Users\Jadiac\Desktop\Lolbot1\Images\Hud\ShopIcon.png', region=(320, 860, 1320, 1075), grayscale=True, confidence=0.8) != None:
            Shopx, Shopy = pyautogui.locateCenterOnScreen(r'C:\Users\Jadiac\Desktop\Lolbot1\Images\Hud\ShopIcon.png')            
            print("Shopicon location is:", Shopx, Shopy)
            sleep(0.5)
    else:
        print("Cannot find ShopIcon!")

    if  pyautogui.locateOnScreen(r'C:\Users\Jadiac\Desktop\Lolbot1\Images\Hud\spawnPad.png', region=(320, 860, 1320, 1075), grayscale=True, confidence=0.3) != None:
            Spawnx, Spawny = pyautogui.locateCenterOnScreen(r'C:\Users\Jadiac\Desktop\Lolbot1\Images\Hud\spawnPad.png')           
            print("Spawn location is:", Spawnx, Spawny)
            sleep(0.5)
    else:
        print("Cannot find Spawnpad!")
print("done")
Error:
Traceback (most recent call last): File "c:/Users/Jadiac/Desktop/Test/A.py", line 14, in <module> Spawnx, Spawny = pyautogui.locateCenterOnScreen(r'C:\Users\Jadiac\Desktop\Lolbot1\Images\Hud\spawnPad.png') TypeError: cannot unpack non-iterable NoneType object
If anyone could explain this to me and tell me how to counter this I would love to hear any help :)
Reply


Messages In This Thread
Cannot unpack non-iterable NoneType object, i would like to ask for help on this. - by Jadiac - Oct-18-2020, 02:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Too much values to unpack actualpy 3 537 Feb-11-2024, 05:38 PM
Last Post: deanhystad
Bug TypeError: 'NoneType' object is not subscriptable TheLummen 4 820 Nov-27-2023, 11:34 AM
Last Post: TheLummen
  TypeError: 'NoneType' object is not callable akbarza 4 1,142 Aug-24-2023, 05:14 PM
Last Post: snippsat
  Python: Regex is not good for re.search (AttributeError: 'NoneType' object has no att Melcu54 9 1,639 Jun-28-2023, 11:13 AM
Last Post: Melcu54
  TypeError: 'NoneType' object is not subscriptable syafiq14 3 5,341 Sep-19-2022, 02:43 PM
Last Post: Larz60+
Question how to solve `'TypeError: 'int' object is not iterable`? netanelst 2 1,643 May-24-2022, 12:03 PM
Last Post: deanhystad
  unpack dict menator01 1 1,247 Apr-09-2022, 03:10 PM
Last Post: menator01
  ValueError: not enough values to unpack (expected 4, got 1) vlearner 2 6,402 Jan-28-2022, 06:36 PM
Last Post: deanhystad
  AttributeError: 'NoneType' object has no attribute 'group' MaartenRo 3 4,861 Jan-02-2022, 09:53 AM
Last Post: snippsat
  AttributeError: 'NoneType' object has no attribute 'group' MaartenRo 3 2,790 Jan-01-2022, 04:16 PM
Last Post: MaartenRo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020