I don't have PSYCOPG2 on my system, but try doing the following from python: [mgogala@umajor ~]$ python3 Python 3.9.1 (default, Jan 20 2021, 00:00:00) [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cx_Oracle >>> dir(cx_Oracle) ['ATTR_PURITY_DEFAULT', 'ATTR_PURITY_NEW', 'ATTR_PURITY_SELF', 'ApiType', 'BFILE', 'BINARY', 'BLOB', 'BOOLEAN', 'Binary', 'CLOB', 'CURSOR', 'Connection', 'Cursor', 'DATETIME', 'DBSHUTDOWN_ABORT', ------------ 'DBSHUTDOWN_FINAL', 'DBSHUTDOWN_IMMEDIATE', 'DBSHUTDOWN_TRANSACTIONAL', 'DBSHUTDOWN_TRANSACTIONAL_LOCAL', 'DB_TYPE_BFILE', 'DB_TYPE_BINARY_DOUBLE', 'DB_TYPE_BINARY_FLOAT', 'DB_TYPE_BINARY_INTEGER', 'DB_TYPE_BLOB', 'DB_TYPE_BOOLEAN', 'DB_TYPE_CHAR', 'DB_TYPE_CLOB', 'DB_TYPE_CURSOR', 'DB_TYPE_DATE', 'DB_TYPE_INTERVAL_DS', 'DB_TYPE_INTERVAL_YM', 'DB_TYPE_JSON', 'DB_TYPE_LONG', 'DB_TYPE_LONG_RAW', 'DB_TYPE_NCHAR', 'DB_TYPE_NCLOB', 'DB_TYPE_NUMBER', 'DB_TYPE_NVARCHAR', 'DB_TYPE_OBJECT', 'DB_TYPE_RAW', 'DB_TYPE_ROWID', 'DB_T .......................................
>>> conn=cx_Oracle.Connection("scott/tiger@ora19c") >>> Please use PSYCOPG2 instead of cx_Oracle. After you do it from python3 interpreter do it from Idle: On Sat, 13 Feb 2021 22:08:11 +0000, Tony Ogilvie wrote: > Thank you > > I have tried Sublime 3 and the same thing happens. I do not think I have > another version of Python on my PC. I am trying to look through my files > to find out. > > Regards > > Tony > > > -----Original Message----- > From: Mladen Gogala <mgog...@yahoo.com> > Sent: 13 February 2021 05:35 To: python-list@python.org Subject: Re: > PSYCOPG2 > > 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. >> >> >> >> Regards >> >> >> >> Tony > > 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. -- Mladen Gogala Database Consultant https://dbwhisperer.wordpress.com -- https://mail.python.org/mailman/listinfo/python-list