I am trying to connect to postgresql using pyside2. But, when I try to call the open method, the program stops running without showing any error.
This is my code:
from PySide2.QtSql import QSqlDatabase, QSqlQuery
from PySide2.QtWidgets import QApplication
app = QApplication([])
db = QSqlDatabase.addDatabase("QPSQL")
db.setHostName("localhost")
db.setDatabaseName("mydatabase")
ok = db.open("user", "password")
print("hola")
The line print("hola")
show nothing.
I'm pretty sure there's an internal error happening, but I can't see it. If they need to see the error message, they will have to explain step by step how to get it.
I was searching on Google and it seems that I am the only one in the world that this happens to him. Thanks for any help you can give me.