On 13/02/2021 18.34, Mladen Gogala via Python-list wrote: > On Fri, 12 Feb 2021 18:29:48 +0000, Tony Ogilvie wrote: > >> I am trying to write a program to open a PostgesSQL 13 database using >> psycopg2. All seems to work if I write direct to Python but if I write >> the script into IDLE it does not work with the IDLE Shell 3.9.1 >> reporting an error of no attribute 'connect'. >> >> I have tried many options to try and get this to work.
Please copy-paste the code of at least one of these "options", together with the full error-listing. Before using the connect function, the module must be import-ed. Has this been done? If so, an error with connect() probably indicates a problem with the function call, eg locating the database. - as said, really difficult without seeing any code and the err.msgs generated! > It looks like your idle is not using the same interpreter that you are > using when writing direct code. Anyway, my advice would be to ditch Idle > and use VSCode. It's fabulous. Would it? Surely if the issue is 'connecting bits together', regardless one still has to learn the tool and how it works/expects things to be organised? So, rather than helping the OP with a Postgres/Python/psycopg2 linkage problem, hasn't (s)he now been presented with an extra learning load? Regardless, rather than recommending that people send their 'telemetry/tracking data' to MSFT, why not suggest VSCodium (https://vscodium.com/) - the same open-source IDE, before any such 'extras' are added. Disclaimer: I do not use or publish Idle, VS-Code, or VSCodium, and have nothing to gain/lose by MSFT collecting data about what you are doing with the help of 'their' product. -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list