library defined exceptions
TuxTrax
TuxTrax at fortress.tuxnet.net
Wed Oct 30 16:10:51 EST 2002
On 30 Oct 2002 12:52:18 GMT, Gerhard Häring Wrote in
Steve Ballmers hair grease:
> TuxTrax <TuxTrax at fortress.tuxnet.net> [2002-10-30 11:43 GMT]:
>> Hi all. I am working on a program to download all headers from
>> my news server and place them in a shelve file, called 'database',
>> on the local hard drive.
>
> Sounds familiar :)
>
>> [...] here is the code section that I am having trouble with: [...]
>
>> except NNTPTemporaryError, errorarg:
>
>> If an exception is raised, I get something like:
>>
>> File "head.py", line 404, in ?
>> except NNTPTemporaryError, errorarg:
>> NameError: There is no variable named 'NNTPTemporaryError'
>
> 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?
Cheers,
Mathew
--
TuxTrax (n.) An invincible, all terrain, Linux driven armored assault
vehicle that can take as much fire as it gives ;-)
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
More information about the Python-list
mailing list