On Sun, Dec 28, 2008 at 07:09:51PM +0100, Sander Sweers wrote:
> I am having issues cathing exceptions from telnetlib. What I am doing is:
> except gaierror:
> Which gives me "NameError: name 'gaierror' is not defined" :-(

This error message contains your clue.  If the name you're referencing is not 
defined, you usually forgot to either explicitly import it, or to name it with 
its namespace attached.

So you either want to say:

        from telnetlib import gaierror

at the top of your script, or if you earlier said simply "import telnetlib",

then your try/except clause would be like:

        except telnetlib.gaierror:


-- 
Steve Willoughby    |  Using billion-dollar satellites
st...@alchemy.com   |  to hunt for Tupperware.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to