| 
      
      
      From:  <gh...@gh...> - 2003-06-12 15:43:02
      
     | 
| Pinchart, Laurent wrote:
> [Win95 and host name resolution]
> I experienced the same problem today in Windows 2000.
 From what I see, this is a totally different problem.
> ----------------------------------------------------------------------------
> ------
> $ python
> Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> 
>>>>from pyPgSQL import PgSQL
>>>>PgSQL.connect()
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "D:\Soft\Python22\lib\site-packages\pyPgSQL\PgSQL.py", line 2118, in
> connect
>     return Connection(connInfo, client_encoding, unicode_results)
>   File "D:\Soft\Python22\lib\site-packages\pyPgSQL\PgSQL.py", line 2215, in
> __init__
>     raise DatabaseError, m
> libpq.DatabaseError: could not create socket: WSAStartup not yet called
> (0x00002
> 76D/10093)
I cannot reproduce this:
#v+
C:\>python
Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> from pyPgSQL import PgSQL
 >>> PgSQL.connect()
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "c:\python22\lib\site-packages\pyPgSQL\PgSQL.py", line 2118, in 
connect
     return Connection(connInfo, client_encoding, unicode_results)
   File "c:\python22\lib\site-packages\pyPgSQL\PgSQL.py", line 2215, in 
__init__
     raise DatabaseError, m
libpq.DatabaseError: could not create socket: Address family not 
supported (0x00
00273F/10047)
#v-
This is clear, because Windows doesn't support Unix domain sockets, so 
you *always* have to use a hostname on win32, even if a native or Cygwin 
PostgreSQL server is running on localhost.
>>>>PgSQL.connect(host="localhost", database="Test")
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "D:\Soft\Python22\lib\site-packages\pyPgSQL\PgSQL.py", line 2118, in
> connect
>     return Connection(connInfo, client_encoding, unicode_results)
>   File "D:\Soft\Python22\lib\site-packages\pyPgSQL\PgSQL.py", line 2215, in
> __init__
>     raise DatabaseError, m
> libpq.DatabaseError: unknown host name: localhost
That's very strange. Have you compiled pyPgSQL yourself from sources? 
Have you linked it dynamically against libpq? The binaries I offer on SF 
are built *statically* against libpq and do not suffer from this problem.
Which PostgreSQL version do you link against?
-- Gerhard
 |