The python-oracledb code:
import oracledb
import os
un = os.environ.get("PYTHON_USERNAME")
pw = os.environ.get("PYTHON_PASSWORD")
cs = "localhost/orclpdb1"
c = oracledb.connect(un, pw, dsn=cs)
fails with the error:
TypeError: connect() got multiple values for argument 'dsn'
How do I fix this?
Update: in python 1.0.0 the error was TypeError: wrapped() got multiple values for argument 'dsn'
In 1.0.1 the wrapped()
was replaced by the connect or create pool function name used in the application code.
The solution is to consistently use keyword parameters:
c = oracledb.connect(user=un, password=pw, dsn=cs)
or
pool = oracledb.create_pool(user=un, password=pw, dsn=cs, min=4, max=4, incr=1)
The oracledb.connect()
and oracledb.create_pool()
(and deprecated
oracledb.SessionPool()
) parameters are keyword, not positional. This complies
with the Python Database API spec PEP 249.