How to handle errors?

John Gordon gordon at panix.com
Thu Oct 20 16:27:43 EDT 2016


In <8500044a-c8d1-43ad-91d9-e836d52bd3f0 at googlegroups.com> SS <sami.strat at gmail.com> writes:

> I would like to be able to handle that error a bit better.  Any ideas?

Wrap the socket.gethostbyname() call in a try/except block.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list