Hello again,

Am I just being exceptional or dumb? I’m trying to catch the exception below but am I missing something?


Ok so I tried:

>>> socket.gethostbyname("por-wq-moore")

Traceback (innermost last):

  File "<console>", line 1, in ?

  File "C:\jython2.2\Lib\socket.py", line 344, in gethostbyname

gaierror: (20001, 'getaddrinfo failed')


based on what I think I know the exception to catch is ‘gaierror’.


So I wrote:

>>> try:

...     x = socket.gethostbyname("por-wq-moore")

...     print 'host ip addr: ', x

... except gaierror, ge:

...     print 'something exceptional happened'

...     print ge


And got an unexpected:

Traceback (innermost last):

  File "<console>", line 2, in ?

NameError: gaierror


So I went and looked at socket.py and got further confused. First why is a getaddressinfo exception being thrown but more importantly how do I catch this exception?


Thanks in advance.




-=[ Greg W Moore | FSD QA | ADP Dealer Services | greg_w_moore@adp.com | 503-294-5859 ]=-


This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.