'TypeError: 'NoneType' object is not iterable python3
this is the class i use inside my python file :
class SatelliteList(MenuList):
def __init__(self):
MenuList.__init__(self, list=[], enableWrapAround=True, content=eListboxPythonMultiContent)
if FHD_Res:
self.l.setItemHeight(40)
self.l.setFont(0, gFont('Regular', 27))
else:
self.l.setItemHeight(24)
self.l.setFont(0, gFont('Regular', 20))
def setEntries(self, satelliteslist):
res = []
for x in satelliteslist:
satparameter = x[0]
satentry = []
pos = int(satparameter.get('position'))
if pos < 0:
pos += 3600
satentry.append(pos)
color = None
color_sel = None
if satparameter.get('selected', False):
color = 0
color_sel = 65344
backcolor = None
backcolor_sel = None
a = FHD_Res and 1050 or HD_Res and 700 or 430
b = FHD_Res and 255 or HD_Res and 170 or 103
if len(x) == 1:
backcolor = 1644912
backcolor_sel = 9466996
if FHD_Res:
satentry.append(MultiContentEntryText(pos=(0, 0), size=(a, 40), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_TOP, text=satparameter.get('name'), color=color, color_sel=color_sel, backcolor=backcolor, backcolor_sel=backcolor_sel, border_width=1, border_color=15792383))
else:
satentry.append(MultiContentEntryText(pos=(0, 0), size=(a, 24), font=0, flags=RT_HALIGN_LEFT | RT_VALIGN_TOP, text=satparameter.get('name'), color=color, color_sel=color_sel, backcolor=backcolor, backcolor_sel=backcolor_sel, border_width=1, border_color=15792383))
pos = int(satparameter.get('position'))
posStr = str(abs(pos) / 10) + '.' + str(abs(pos) % 10)
if pos < 0:
posStr = posStr + ' ' + 'West'
if pos > 0:
posStr = posStr + ' ' + 'East'
if pos == 0:
posStr = posStr + ' ' + 'Greenwich'
if FHD_Res:
satentry.append(MultiContentEntryText(pos=(a, 0), size=(b, 40), font=0, flags=RT_HALIGN_CENTER | RT_VALIGN_TOP, text=posStr, color=color, color_sel=color_sel, backcolor=backcolor, backcolor_sel=backcolor_sel, border_width=1, border_color=15792383))
else:
satentry.append(MultiContentEntryText(pos=(a, 0), size=(b, 24), font=0, flags=RT_HALIGN_CENTER | RT_VALIGN_TOP, text=posStr, color=color, color_sel=color_sel, backcolor=backcolor, backcolor_sel=backcolor_sel, border_width=1, border_color=15792383))
res.append(satentry)
after running i got the following error:
Traceback (most recent call last):
line 905, in setEntries
for x in satelliteslist:
TypeError: 'NoneType' object is not iterable
how can i fix that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
