Newbie and exceptions.

Gillou nospam at bigfoot.com
Sat Feb 23 11:27:23 EST 2002


"Jan Johansson" <spamfilter2 at mupp.net> a écrit dans le message news:
f0gf7u8h6tn05bf4a7orbnsm0e0lsn3oa6 at 4ax.com...
> How on earth do i define errors to trap from ftplib?
>
> http://www.python.org/doc/current/lib/module-ftplib.html states
> "exception error_perm"  but "except error_perm:" gives me
>
>    except error_perm:
> NameError: name 'error_perm' is not defined
>
>
> why? and what is the proper way?

try...

except ftplib.error_perm:

...or...

# Near the start of the script
from ftplib import error_perm

# Continue as before
...





More information about the Python-list mailing list