py2exe socket.gaierror (10093)

Tim Golden mail at timgolden.me.uk
Thu Mar 27 05:01:26 EDT 2008


Python Programming on Win32 wrote:
> The problem is running smtplib in a py2exe compiled exe file. When it
> tries to establish a socket to the mail server it fails.
> 
> Just wondering someone has encountered this before, and if someone
> might be able to point me in the right direction.
> 
> Unhandled exception in thread started by
> Traceback (most recent call last):
>   File "AutomationThread.pyc", line 152, in Run
>   File "mail.pyc", line 11, in sendMail
>   File "smtplib.pyc", line 244, in __init__
>   File "smtplib.pyc", line 296, in connect
> socket.gaierror: (10093, 'getaddrinfo failed')

In case it helps, this is the text for error 10093:

"""
WSANOTINITIALISED
10093
	
Successful WSAStartup not yet performed.

     Either the application has not called WSAStartup or WSAStartup 
failed. The application may be accessing a socket that the current 
active task does not own (that is, trying to share a socket between 
tasks), or WSACleanup has been called too many times.
"""

WSAStartup is called by a process which wants to use winsock,
the Windows sockets implementation and it's called by Python's
socket module at startup. I can't see anything in py2exe's
source which should make any difference to socket initialisation
so I'm at a loss.

TJG



More information about the Python-list mailing list