Yes the error message is crucial and tells exactly what is wrong.
Now I do not know SQLite3 so perhaps I'm not the right person to investigate, but I think you are messing around with the variable "conn". You seem to expect a global version and a local version. In "create_connection()" you create a connection (conn is local in that function). In line 21 you use the function but you do not assign the result to anyting, so the result of the connection gets lost.
In "main()" line 48 you do it right:
In "my_form()" in line 70 things go wrong (as the error message says). You do:
I would suggest you remove line 21 (it does nothing in your program, but it may keep a connection open on your database thus using resources) and add a line
Like I said I do not know SQLite3, but in general everything that has been opened should be closed too. So both the cursor and the connection should be closed somewhere I guess.
Now I do not know SQLite3 so perhaps I'm not the right person to investigate, but I think you are messing around with the variable "conn". You seem to expect a global version and a local version. In "create_connection()" you create a connection (conn is local in that function). In line 21 you use the function but you do not assign the result to anyting, so the result of the connection gets lost.
In "main()" line 48 you do it right:
conn = create_connection(database)But the "conn" variable remains local in the "main()" function.
In "my_form()" in line 70 things go wrong (as the error message says). You do:
c = conn.cursor()... but conn is not available, neither local nor global.
I would suggest you remove line 21 (it does nothing in your program, but it may keep a connection open on your database thus using resources) and add a line
conn = create_connection(database)
to the function "my_form()".Like I said I do not know SQLite3, but in general everything that has been opened should be closed too. So both the cursor and the connection should be closed somewhere I guess.