Search code examples
pythonsettypeerror

TypeError: '<' not supported between instances of 'NoneType' and 'str'


I"m getting this error as I try to make a ttk.Combobox using the values of a set that I select from a .db file.

for row in self.sql.execute("SELECT {0} FROM Songinfo".format(self.variable1.get())):
        self.List2.append(row)
        self.seen.add(row)
self.Option2 = ttk.Combobox(self, values=sorted(self.seen), textvariable=self.variable2)
self.Option2.grid(row=3, column=1)

self.seen, when printed out returns something like:

{('Heavy Metal',), ('Soundtrack',), ('Pop/Rock',), ('Metal',), 
 ('Alternative',), ('Alternative & Punk',), ('Rock',),
 ('Pop',), ('Classical Crossover',), (None,)}

this is a set of genres. I'm getting that error and I'm not sure why, it wasn't an issue till recently, any help is appreciated, thanks.


Solution

  • Remove the offending tuple from your set:

    self.seen = {x for x in self.seen if x[0] is not None}