[PySide2] Destroying the QApplication instance and creating another one gives an error
-
Hello I have a simple app which creates an application, destroys it and then creates another application again.
It works with PyQt5, but fails with PySide2, giving "RuntimeError: Please destroy the QApplication singleton before creating a new QApplication instance.". But I am already destroying the QApplication instance, or at least I think I am destroying it via "del app":
import sys from PySide2.QtWidgets import * app = QApplication(sys.argv) label = QLabel("Hello World") label.show() app.exec_() del app app = QApplication(sys.argv) label = QLabel("Hello World") label.show() app.exec_() sys.exit()
What might be the problem?
-
@canol
You should perhaps coordinate this question with https://forum.qt.io/topic/110418/how-to-destroy-a-singleton-and-then-create-a-new-one, which seems to be the same on-going question.From what I have seen
del app
should work, but you say it does not from PySide2. If so, good luck, because I haven't come across a different answer for PySide2....