psycopg2.OperationalError: fe_sendauth: no password supplied⁠?

1

It turns out that I'm trying to get my program to get data from a database generated from pgadmin, but I'm not making it happen.

I'm trying to make this work:

from psycopg2 import connect
import dbconfig
cfg=dbconfig
dbname=cfg.dbname
dbhost=cfg.dbhost
dbport=cfg.dbport
dbusu=cfg.dbusu
contrasena=cfg.contrasena

##Conexion con la BD
conexion=connect("dbname="+str(dbname)+"host="+str(dbhost)+"port="+str(dbport)+"user="+str(dbusu)+"password="+(contrasena)) 

conexion=connect("dbname=uaa host=localhost port=5432 user=postgres password=uaa123")

dbconfig:

# Variables Iniciales
dbhost='localhost'
dbport=5432
dbusu='postgres'
dbname='uaa'
contrasena='uaa123'

I get the error:

psycopg2.OperationalError: fe_sendauth: no password supplied⁠⁠⁠⁠

If you can help me, I would really appreciate it.

    
asked by Ana 07.07.2017 в 22:01
source

1 answer

1

Try this way, separated by commas and each parameter you need

psycopg2.connect(dbname="test", user="postgres", password="secret")
    
answered by 07.07.2017 в 22:11