Returning to 'try' block after catching an exception

Jake Anderson jake at vapourforge.com
Thu May 22 04:14:30 EDT 2008


alex23 wrote:
> On May 22, 9:13 am, Karlo Lozovina <_karlo_ at _mosor.net_> wrote:
>   
>> In case it's not clear what I meant: after executing some_function()
>> exception SomeExcpetion gets risen. Then, in except block I do something
>> to fix whatever is causing the exception and then I would like to go back
>> to try block, and execute some_function() again. Is that doable?
>>     
>
> If you know what exception to expect, and you know how to "fix" the
> cause, why not just put tests _before_ some_function() is called to
> ensure that everything is as it needs to be?
> --
> http://mail.python.org/mailman/listinfo/python-list
>   
There are cases where this could be helpful
FTP upload that would sometimes get cut off along the way. So you might 
want to just try again depending on why the failure happened perhaps.

Command of "ReTry" sounds good to me ;->
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080522/88efc96b/attachment.html>


More information about the Python-list mailing list