When I run a routine to open my database and insert values i get the error: sqlite3.OperationalError: database is locked
and a file is created with my database name (in the same directory) system.db-journal.
Could anyone please help me? Before i run this routine i ran a login routine which accessed the database successfully with no errors. I have many other routines in the backend file what access the database and they finish with conn.commit and conn.close thus I don't know what the issue is - but feel it has something to do with the file generated.
A small subsection of the function which induces the error (Willing to provide more code but will get complicated quickly)
#frontend.py
backend.Database.customerOrders(choice,size,milkOptions,today,
PageTwo.quantity,PageTwo.price,customerID)
#Backend.py
#INSERT ORDER DETAILS
def customerOrders(product,size,milkOptions,date,quantity,price,customerID):
conn=sqlite3.connect("system.db")
cur=conn.cursor()
cur.execute("INSERT INTO customerOrders VALUES (NULL,?,?,?,?,?,?,?)",(product,size,milkOptions,date,quantity,price,customerID))
conn.commit()
conn.close()
sqlite3.OperationalError: database is locked
File created in same directory system.db-journal.