By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,996 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,996 IT Pros & Developers. It's quick & easy.

py2exe socket.gaierror (10093)

P: n/a
Hi,

I have encountered a problem which I can not figure out a solution
to.
Tried Googeling it, but to no help unfortunately.

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')
Thank you !
Mar 26 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
En Wed, 26 Mar 2008 11:17:15 -0300, Python Programming on Win32
<kn********@gmail.comescribió:
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')
The script can't resolve the server name. Try to do it by hand using
nslookup or even ping (you may want to add a few print statements inside
the script to see the exact host name it is trying to connect to, in case
it isn't what you expect)
If you can't resolve the host name using nslookup, there is a network
problem, not in your script. If you can resolve it, try your script
without py2exe if possible.

--
Gabriel Genellina

Mar 26 '08 #2

P: n/a
The script can't resolve the server name. Try to do it by hand using
nslookup or even ping (you may want to add a few print statements inside
the script to see the exact host name it is trying to connect to, in case
it isn't what you expect)
If you can't resolve the host name using nslookup, there is a network
problem, not in your script. If you can resolve it, try your script
without py2exe if possible.

--
Gabriel Genellina
Thank you for the quick reply Gabriel.

I have made sure the script works fine before I exe it.
It is when I compile the program I get this error.

I don't get how the compile changes server availability.
Thanks again,
Knut
Mar 26 '08 #3

P: n/a
Knut schrieb:
>The script can't resolve the server name. Try to do it by hand using
nslookup or even ping (you may want to add a few print statements inside
the script to see the exact host name it is trying to connect to, in case
it isn't what you expect)
If you can't resolve the host name using nslookup, there is a network
problem, not in your script. If you can resolve it, try your script
without py2exe if possible.

--
Gabriel Genellina

Thank you for the quick reply Gabriel.

I have made sure the script works fine before I exe it.
It is when I compile the program I get this error.

I don't get how the compile changes server availability.
Could it be a firewall issue?

Thomas

Mar 26 '08 #4

P: n/a
On 26 Mar, 23:08, Thomas Heller <thel...@ctypes.orgwrote:
Knut schrieb:
The script can't resolve the server name. Try to do it by hand using
nslookup or even ping (you may want to add a few print statements inside
the script to see the exact host name it is trying to connect to, in case
it isn't what you expect)
If you can't resolve the host name using nslookup, there is a network
problem, not in your script. If you can resolve it, try your script
without py2exe if possible.
--
Gabriel Genellina
Thank you for the quick reply Gabriel.
I have made sure the script works fine before I exe it.
It is when I compile the program I get this error.
I don't get how the compile changes server availability.

Could it be a firewall issue?

Thomas
Hi Thomas,

Thanks for the tip!

Disabled the firewall to check if this could be the problem, but no
help there either..

The mail server is on the local network, but I have also tried
connecting to internal sockets to another program I have which sniffs
a port.
This works fine, until I run it as an exe..
My quest continues..
Mar 27 '08 #5

P: n/a
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
Mar 27 '08 #6

P: n/a
This is frustrating.

I was working on writing a sample for my problem. I start with
dissecting my code which still gives the same error. Then I start
thinking that it might be my setup file doing the damage. And i start
it from scratch. Everything suddenly works.

Fine! i think, i will have to start over with the setup file. Buy i
give the old setup a last go, and guess what. It works.
So I am honestly utterly frustrated.. I have no idea what what the
reason for the problem, but apparently it is solved, for now.
Thanks for all you comments and help. I really appreciate it!

K
Mar 27 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.