def addToDb(self): try: # Adding variable names to the text boxes on add information windows Exercise = self.ui.lineEditFood.text() Calories = self.ui.lineEditCalories.text() # Stores the user ID as a variable and removes the excess string UserID = self.userID UserID = str(UserID) UserID = (UserID.replace("(", "")) UserID = (UserID.replace(")", "")) UserID = (UserID.replace(",", "")) # Validation Check. if (SQLStatements.addExercise(Exercise, Calories, UserID) == 'True'): QMessageBox.about(QMessageBox(), 'Success', 'added to the database.') else: QMessageBox.warning(QMessageBox(), 'Error', 'Could not be added') except Exception as e: print(e)