1 message in org.python.python-bugs-list[ python-Bugs-913698 ] smtplib module...
FromSent OnAttachments
SourceForge.netMar 10, 2004 3:48 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[ python-Bugs-913698 ] smtplib module : fatal error with unresolved hostnameActions...
From:SourceForge.net (nore@sourceforge.net)
Date:Mar 10, 2004 3:48:57 pm
List:org.python.python-bugs-list

Bugs item #913698, was opened at 2004-03-10 21:49 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=913698&group_id=5470

Category: Extension Modules Group: Python 2.3 Status: Open Resolution: None Priority: 5 Submitted By: Zarro (chaica) Assigned to: Nobody/Anonymous (nobody) Summary: smtplib module : fatal error with unresolved hostname

Initial Comment: I checked in the last cvs and the bug wasn't corriged.

if your hostname can't be resolved, so the module will panic and raise a socket.gaierror in line 254:

addr = socket.gethostbyname(socket.gethostname())

import socket socket.gethostname() 'desktop' socket.gethostbyname(socket.gethostname())

Traceback (most recent call last): File "<stdin>", line 1, in ? socket.gaierror: (-2, &#039;Name or service not known&#039;)

To correct, catch the exception and give a generic value for self.local_hostname, for example localhost 127.0.0.1

try: addr = socket.gethostbyname(socket.gethostname()) self.local_hostname = &#039;[%s]&#039; % addr except socket.gaierror, msg: self.local_hostname = &#039;[%s]&#039; % &#039;127.0.0.1&#039;

Keep me tuned, cha@ohmytux.com

----------------------------------------------------------------------