Exit the sqlite3 shell:
except sqlite3.IntegrityError as e: print(f"Integrity error (duplicate key, etc): e") if conn: conn.rollback()