From: Chris W. <cw...@cf...> - 2003-06-12 22:18:26
|
Thanks Laurent, I'll try the socket trick first thing tomorrow. Odd that the Win98 clients have no problems here. I don't know if Gerhard's question was directed at me, but on the windows clients I'm using strictly the "canned" installs from the parent web sites. I have no windows build capabilities at all. Regards, Chris On Thu, 2003-06-12 at 10:53, Pinchart, Laurent wrote: > > >> 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: unknown host name: 192.168.1.160 > > I experienced the same problem today in Windows 2000. > > ---------------------------------------------------------------------------- > ------ > $ 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) > > >>> 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 > > >>> import socket > >>> PgSQL.connect(host="localhost", database="Test") > <pyPgSQL.PgSQL.Connection instance at 0x008359D0> > >>> > ---------------------------------------------------------------------------- > ------ > > It seems that pyPgSQL forgets to initialize Winsock (WSAStartup). Or should > libpq do it ? This should be investigated. > > Anyway, for a quick workaround, just import socket and it should work > properly. > > Laurent Pinchart -- Chris Wren <cw...@cf...> |