TypeError: 'NoneType' object is not iterable stocker github code example

Example 1: TypeError: 'NoneType' object is not iterable

def write_file(data, filename): # creates file and writes list to it
  with open(filename, 'wb') as outfile:
    writer = csv.writer(outfile)
    for row in data: # ABOVE ERROR IS THROWN HERE
      writer.writerow(row)

Example 2: TypeError: 'NoneType' object is not iterable

conn.execute("select name from artists order by name")
row = conn.fetchall() #in mysql we must use fetchall() function inorder to split dataa beecause remember it is different from sqlite we use  cursor here
for artist in row:
    artistlist.insert(tkinter.END, artist[0])