PSYCOPG2
Mladen Gogala
mgogala at yahoo.com
Sat Feb 13 20:07:49 EST 2021
I don't have PSYCOPG2 on my system, but try doing the following from
python:
[mgogala at 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 at 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 <mgogala at yahoo.com>
> Sent: 13 February 2021 05:35 To: python-list at 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
More information about the Python-list
mailing list