I'm on Windows, with a 32bit install of python 2.6.6 and psycopg2.
When psycopg2 tries to connect, it gets an OperationalError
:
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
>>> conn = psycopg2.connect("dbname=your_database user=postgres password=xxxx host=127.0.0.1:5432")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\site-packages\psycopg2\__init__.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: could not translate host name "127.0.0.1:5432" to address: Unknown server error
I am able to connect to PostgreSQL instance with pgAdmin3 on 127.0.0.1:5432
.
Any idea?
Removing the port
:5432
from thehost
name worked for me.