Trying to setup a button to write to a MySQL database.
Though the post don’t show it the first line “def” is the only one that is not tabbed.
def runAction(self, event): """ Method that will run whenever the selected event fires. Arguments: self: A reference to the component that is invoking this function. event: An object that holds information about the selected event type """ DateV = system.date.now() idV = 1 query = "UPDATE table SET date = ? WHERE id = ?" args = [DateV, idV] system.db.runPrepUpdate(query, args)
I then get:
Unable to run function “runAction(self, event)”, code could not be compiled.
org.python.core.PySyntaxError: SyntaxError: (“mismatched input ‘’ expecting INDENT”, (’’, 1, 27, ‘def runAction(self, event):\n’))