[Tutor] I need to ignore an error let the script continue to run

Jim jf_byrnes at comcast.net
Tue May 5 16:34:49 EDT 2020


On 5/5/20 9:47 AM, Jim wrote:

>>>
>>> It seems try/except will not process the keys after the missing one.
>>>
>>> I looked at something like dict.get(key, 'blank') but I can't figure out
>>> how to handle these two cases:
>>>
>>> 'Recepient username: ' + header['to'].addresses[0].username+'\n',
>>> 'Sender name: ' + header['from'].addresses[0].display_name
>>
>> I believe these are wired to work so you can do "in" checks:
> 
> OK, I'll give that a try.
> 

It seems like every time I tried to use the 'in' check what I was 
checking would resolve itself (if that's correct terminology) and throw 
an error. I ended up using Alan's idea of wrapping them both 
individually in try/except and that worked.

Thanks for taking the time to look at my problem.

Regards, Jim



More information about the Tutor mailing list