Search code examples
pythonpython-multithreadingpyside6

Getting access violation 0xc0000005 when updating QTextEdit


I am scraping some data on the internet using selenium, I needed my Pyside6 app to get updated, so I have this code to update a QTextEdit:

def log_out(self, MSG, TYPE):
    text = self.view.console.toPlainText()
    if TYPE == "Important":
        self.view.console.setText(text + "\n" + "                                          " + MSG)
    else:
        self.view.console.setText(text + "\n" + MSG)

I ran this code before entering a thread, and it worked just fine, but when I try to update it from inside the thread, it throughs this error and closes the app window without anything else. Does anyone have an idea how to solve this?


Solution

  • Thanks for all the help @PaulCornelius and @Alexander, I found that the problem was actually that I was updating my QTextEdit two times consecutively. I don't know why would that be a problem, but when I removed one of the two, it worked.