title: Process finished with exit code 1073741845 while saving data to mysql
body: <p>I have tried to update the database from two different locations in the same code.
  The first one works which is in the 
  <code>__init__(self)</code>
  It was just added to check if the update throws any error.</p>
  
  <p>The second one throws this error.
  onClickAction_SAVE(self) is where this happens.
  Error:
  Process finished with exit code 1073741845</p>
  
  <pre><code>
  
  from PyQt5.QtWidgets import *
  from PyQt5.QtCore import *
  from myform import Ui_Form
  from connect_to_db import Database
  import pandas as pd
  
  class AppWindow(QMainWindow):
      def __init__(self):
          super().__init__()
          self.ui = Ui_Form()
          self.ui.setupUi(self)
          self.ui.lineEdit.textChanged.connect(self.touppercase)
          self.ui.lineEdit_2.setPlaceholderText("Don't mind me.")
  
          self._db = Database('accounts')
          self._currrow = 0
  
  
          self._df = pd.read_sql_query("SELECT * FROM test1", self._db.connection)
          self._maxrows = len(self._df.index)-1
  
          self.ui.totalrecords.display(len(self._df.index))
  
  
          self.ui.lineEdit.setText(self._df.at[self._currrow, 'name'])
          self.ui.lineEdit_2.setText(self._df.at[self._currrow, 'guid'])
          self.ui.currCounter.display(self._currrow + 1)
  
          self.ui.btnFirst.clicked.connect(self.onClickAction_FR)
          self.ui.btnPrev.clicked.connect(self.onClickAction_PR)
          self.ui.btnNext.clicked.connect(self.onClickAction_NR)
          self.ui.btnLast.clicked.connect(self.onClickAction_LR)
          self.ui.btnSave.clicked.connect(self.onClickAction_SAVE)
  
          keyvalue = 8
          namevalue = 'Record 7---'
          stmt = 'UPDATE test1 SET name = %s WHERE id = %s'
          values = (namevalue, keyvalue)
          print((stmt, values))
          try:
              self._db.execute(stmt, values)
          except:
              print("Oops!", sys.exc_info()[0], "occured.")
          self._db.commit()
  
      def touppercase(self, text):
          # print(text)
          cursorpos = self.ui.lineEdit.cursorPosition()
          self.ui.lineEdit.setText(text.upper())
          self.ui.lineEdit.setCursorPosition(cursorpos)
  
      @pyqtSlot()
      def onClickAction_FR(self):
          self._currrow = 0
          self.ui.lineEdit.setText(self._df.at[self._currrow, 'name'])
          self.ui.lineEdit_2.setText(self._df.at[self._currrow, 'guid'])
          self.ui.currCounter.display(self._currrow+1)
  
      @pyqtSlot()
      def onClickAction_PR(self):
          if self._currrow &gt; 0:
              self._currrow = self._currrow - 1
              self.ui.lineEdit.setText(self._df.at[self._currrow, 'name'])
              self.ui.lineEdit_2.setText(self._df.at[self._currrow, 'guid'])
              self.ui.currCounter.display(self._currrow+1)
  
      @pyqtSlot()
      def onClickAction_NR(self):
          if self._currrow &lt; self._maxrows:
              self._currrow = self._currrow + 1
              self.ui.lineEdit.setText(self._df.at[self._currrow, 'name'])
              self.ui.lineEdit_2.setText(self._df.at[self._currrow, 'guid'])
              self.ui.currCounter.display(self._currrow+1)
  
      @pyqtSlot()
      def onClickAction_LR(self):
          self._currrow = self._maxrows
          self.ui.lineEdit.setText(self._df.at[self._currrow, 'name'])
          self.ui.lineEdit_2.setText(self._df.at[self._currrow, 'guid'])
          self.ui.currCounter.display(self._currrow+1)
  
  
      @pyqtSlot()
      def onClickAction_SAVE(self):
          self._df.at[self._currrow, 'name'] = self.ui.lineEdit.text()
          self._df.at[self._currrow, 'guid'] = self.ui.lineEdit_2.text()
          keyvalue = self._df.at[self._currrow, 'id']
          namevalue = self._df.at[self._currrow, 'name']
          stmt = 'UPDATE test1 SET name = %s WHERE id = %s'
          values = (namevalue,keyvalue)
          self._db.execute(stmt,values)
          self._db.commit()
  
  </code></pre>
  
  <p>What is wrong in the onClickAction_SAVE code?</p>
  
  <p>Is there any reason the database connection is closed or update is not allowed in slot?</p>