PyQt5 QtSql MS-Access fails without error

a3veyk a3veyk at yahoo.com
Wed Feb 11 11:15:15 GMT 2026


I was running an application using PyQt5 for years without any problem.  
  Suddenly it failed without showing any error.
I checked using a small test program on different PC's:
Windows 10 /11
Python 3.14        (64 bit)
PyQt5   5.15.11

Test program:

from PyQt5 import QtSql
from PyQt5 import QtGui
import sys
app = QtGui.QGuiApplication(sys.argv)
filepath=r"pathto\\MY_ACCESS.MDB"

db = QtSql.QSqlDatabase.addDatabase("QODBC")
db.setDatabaseName(r"Driver={Microsoft Access Driver (*.mdb, 
*.accdb)};DBQ=%s;" % filepath)
if db.open():
     print("opened")
     print(db.tables())

On my PC with the sudden problem application it fails silently.
On my laptop is runs ok.
On my old laptop (windows 10) it fails also.

When inspecting the data source (64bit) :   It shows the following 
difference:
Working PC:     Microsoft Access Driver (*.mdb, *.accdb) version: 
16.00.19328.20010
Non working PC's:     Microsoft Access Driver (*.mdb, *.accdb) version: 
16.00.19628.20024

The strange thing that is happening is when I run a test using only 
pyodbc  (5.3.0)  without any PyQt5 import, it works on all PC's:

test script:

import pyodbc
# from PyQt5 import QtGui
filepath=r"pathto\\MY_ACCESS.MDB"

connection = pyodbc.connect(r"Driver={Microsoft Access Driver (*.mdb, 
*.accdb)};DBQ=%s;" % filepath)
print(dir(connection))
if not connection.closed:
     cursor = connection.cursor()
     for row in cursor.tables():
         print(row.table_name)

When I uncomment  in the above script  the line  "# from PyQt5 import 
QtGui" it fails again on the 2  problem PC's

Any help is much appreciated





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20260211/d8f92af1/attachment.htm>


More information about the PyQt mailing list