Newbie and exceptions.

Sheila King usenet at thinkspot.net
Sat Feb 23 13:16:13 EST 2002


On Sat, 23 Feb 2002 16:35:15 GMT, Jan Johansson <spamfilter2 at mupp.net>
wrote in comp.lang.python in article
<o8hf7u8mpbmb3d4fi84cliqscb4tbgvqbu at 4ax.com>:

> ># Near the start of the script
> >from ftplib import error_perm
> 
>    except ftplib.error_perm:
> NameError: name 'ftplib' is not defined

ftplib is not defined because you did a 
from ... import

Instead do

import ftplib

Then
except ftplib.error_perm should work.

-- 
Sheila King
http://www.thinkspot.net/sheila/

"When introducing your puppy to an adult cat,
restrain the puppy, not the cat." -- Gwen Bailey,
_The Perfect Puppy: How to Raise a Well-behaved Dog_




More information about the Python-list mailing list