[Tutor] telnetlib unable to cath gaierror
Steve Willoughby
steve at alchemy.com
Sun Dec 28 19:17:30 CET 2008
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
steve at alchemy.com | to hunt for Tupperware.
More information about the Tutor
mailing list