Repeat Python function call on exception?
<p>Hey everybody I'm working on a data scraping project and I'm looking for a clean way to repeat a function call if an exception is raised.</p>

<p>Pseudo-code:</p>

<pre><code>try:
    myfunc(x)
except myError:
    ###try to call myfunc(x) again Y number of times, 
        until success(no exceptions raised) otherwise raise myError2
</code></pre>

<p>I realize this isn't best practice at all but I'm working through a number of different code/network layers that aren't reliable and I can't realistically debug them.</p>

<p>Right now I'm accomplishing this with a huge set of try\except blocks and it's making my eyes bleed.</p>

<p>Elegant ideas anyone?</p>
