import psycopg2 conn = psycopg2.connect( dbname="mirror", user="postgres", password="mirrorapidb", host="127.0.0.1", # localhost port=5432, options="-c client_encoding=LATIN1", # troque LATIN1 por UTF8 se o banco for UTF8 )