library defined exceptions
TuxTrax
TuxTrax at fortress.tuxnet.net
Thu Oct 31 05:02:47 EST 2002
More information about the Python-list mailing list
Thu Oct 31 05:02:47 EST 2002
- Previous message (by thread): library defined exceptions
- Next message (by thread): how to suppress carriage return/line feed?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 30 Oct 2002 23:18:18 GMT, Robin Munn Wrote in Steve Ballmers hair grease: > On Wed, 30 Oct 2002 at 21:10 GMT, TuxTrax <TuxTrax at fortress.tuxnet.net> wrote: >> On 30 Oct 2002 12:52:18 GMT, Gerhard Häring Wrote in >> Steve Ballmers hair grease: >>> >>> You need to qualify the exception classes as well, if you use the "import >>> module" form. I. e. use "nntplib.NNTPTemporaryError". >>> >>> -- Gerhard >> >> it needs to read: >> >> try: >> <code block> >> except nntplib.NNTPTemporaryError, errorarg: >> <code block> >> >> and python will recognize the nntplib defined exceptions, in this case >> NNTPTemporaryError? > > That's correct. Exception names are just like any other names; they > reside in a namespace. When you import a module, only that module's name > gets added to your namespace; every name defined by the module, > including exceptions, go in that module's namespace and are referenced > as attributes of the module. > Thanks Robin. That makes perfect sense. I almost did it right; I used the nntp object created by the library rather than the library name as a qualifier. Understanding why you do something makes the difference! Cheers, Mathew -- My Family is Microsoft Free. Running Mandrake Linux 8.0 kernel 2.4.3-20 I use quality open source software alternatives on my PC. Yes, I am a Penguin cult high priest. Flipper readings upon request. ROT13 this email address to mail me: bar jbeq abg guerr - uvtu qrfreg zna, ng lnubb qbg pbz
- Previous message (by thread): library defined exceptions
- Next message (by thread): how to suppress carriage return/line feed?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list