I have written some SQL data, but when I want to do a fetchone()[0] method to extract the first value of the row, but it returns a traceback stating that "'nontype' object is not subscriptable". I just don't know how to fix that.
I have deleted the [0] part and the traceback disappears, but I need to extract the first value, so the [0] is kind of essential part.
cur.execute('''INSERT OR IGNORE INTO Artist(name) VALUES(?)''',(artist,))
cur.execute('''SELECT id FROM Artist WHERE name=?''',(artist,))
artist_id=cur.fetchone()[0]
conn.commit()
I expect that I could fetch the first value of the extracted row, Which is the id.