I have this pyodbc and sql alchemy connection string. It works fine in its own test script but when I put the same function into my PyQt6 app, it fails with Traceback (most recent call last): File "[FILE PATH]", line 69, in on_login conn = pyodbc.connect(odbc_connect) pyodbc.Error: ('HY000', 'The driver did not supply an error!') Here is the working test function: def on_login(username, password, dsn): odbc_connect = f"DSN={dsn};UID={username};PWD={password}" conn = pyodbc.connect(odbc_connect) dbms = str(conn.getinfo(pyodbc.SQL_DBMS_NAME)).lower() engine = sa.create_engine(f"{dbms}+pyodbc://{username}:{password}@{dsn}") with engine.connect() as connection: df = pd.read_sql("SELECT * from sakila.Actor LIMIT 100;", connection) print(df) conn.close() This is the function within the main PyQT app. The only difference is the parameters self instead of the username, password, dsn. #LOGIN SCREEN self.loginsubwidget = QWidget(self, toolTip = 'Login to Server') login_layout = QVBoxLayout(self.loginsubwidget) label = QLabel('<b>Server Login</b>', self.loginsubwidget, margin = 10) login_layout.addWidget(label) form_layout = QFormLayout() login_layout.addLayout(form_layout) self.DSNcombo = QComboBox(self) available_dsn = pyodbc.dataSources() if available_dsn: self.DSNcombo.addItems(available_dsn.keys()) else: self.DSNcombo.addItems("No DSNs found") form_layout.addRow('DSN', self.DSNcombo) self.usernameenter = QLineEdit(self.loginsubwidget, placeholderText='username', clearButtonEnabled=True, maxLength=20) form_layout.addRow('Username', self.usernameenter) self.passwordenter = QLineEdit(self.loginsubwidget, placeholderText='password') self.passwordenter.setEchoMode(QLineEdit.EchoMode.Password) form_layout.addRow('Password', self.passwordenter) dbconnect_button = QPushButton('Submit', self, shortcut=QKeySequence(Qt.Key.Key_Return)) login_layout.addWidget(dbconnect_button) dbconnect_button.clicked.connect(self.on_login) def on_login(self): username = self.usernameenter.text() password = self.passwordenter.text() dsn = self.DSNcombo.currentText() odbc_connect = f"DSN={dsn};UID={username};PWD={password}" conn = pyodbc.connect(odbc_connect) dbms = str(conn.getinfo(pyodbc.SQL_DBMS_NAME)).lower() engine = sa.create_engine(f"{dbms}+pyodbc://{username}:{password}@{dsn}") with engine.connect() as connection: df = pd.read_sql("SELECT * from sakila.Actor LIMIT 100;", connection) print(df) # Close the connection conn.close() This is my first time using PyQt, and at this point I'm just trying to connect to my odbc connection to build from there. My test odbc is a localhost MySQL database if that helps, but the exact same function works fine in the separate script outside of the form. I did use print() after everything and it was the same as when I hardcoded it. New update: the connection works, but once I import PyQt6 (even lowered the version and tried PyQt5) it fails. This is fully some problem between pyodbc and PyQt. Continue reading...