I'm running a portion of code in a loop. It accesses a global variable only to print it, and that variable is never changed after it is set in the __init__. However, the first print statement occasionally will fail, but the second one does not. Any ideas as to why this is happening? The method is below:
EDIT: it's not the print statement that is failing.
Sometimes the except statement runs for no apparent reason even after the self.cursor.execute completes
def db_insert(self,query_string,*params):
try:
self.cursor.execute(query_string, params)
print ("Inserted into: "+self.database+".")
except:
print("!!!!WARNING!!!! Insertion into "+self.database+" failed.\n")