I am a beginner with Flask, Psycopg2, and Python and I have this little problem, I have created an input() variable that reads users' answer and I want that answer to be put into my databases tables specific column.
print('Are the eyes Open or Closed?: ')
estate1 = input()
def update_Eyes(self):
update_command = ("UPDATE Eyes SET cstate=%s Where id=1", (estate1,))
self.cursor.execute(update_command)
print("Eye table update successful ")
database_connection = DatabaseConnection()
database_connection.update_Eyes()
If I try to add any values myself, it works just fine but I can't seem to find a solution to adding a variable.
The error code looks like this:
Traceback (most recent call last):
File "C:/Users/AJ/Desktop/Data Processing/Flask/first.py", line 136, in <module>
database_connection.update_Eyes() # Updates Table Eyes
File "C:/Users/AJ/Desktop/Data Processing/Flask/first.py", line 98, in update_Eyes
self.cursor.execute(update_command)
TypeError: argument 1 must be a string or unicode object: got tuple instead