On 6/7/21 10:21 AM, Rich Shepard wrote:
On Mon, 7 Jun 2021, Adrian Klaver wrote:

No this is because you did not use an actual connection string e.g:
psycopg2.connect("host=salmo user=rshepard dbname=bustrac")
Instead you used an undefined variable bustrac per the error message:
NameError: name 'bustrac' is not defined

Adrian,

First I'll upgrade 12.2 to 12.7, then I'll upgrade PyQt5.

The code snippet I showed is not tied to PyQt5, it is using psycopg2 and was just a way of seeing if you could connect to the database via Python and get results.

The issue seems to be with the QT driver for the Postgres. This is supplied by QT itself:

https://doc.qt.io/qt-5/sql-driver.html
https://www.riverbankcomputing.com/static/Docs/PyQt5/api/qtsql/qsqldatabase.html

Not sure if a PyQt5 upgrade will by itself do an upgrade of the drivers. That may require an update of QT5.


Thanks,

Rich




--
Adrian Klaver
adrian.kla...@aklaver.com


Reply via email to