title: In Python try until no error
body: <p>I have a piece of code in Python that seems to cause an error probabilistically because it is accessing a server and sometimes that server has a 500 internal server error. I want to keep trying until I do not get the error. My solution was:</p>
  
  <pre><code>while True:
      try:
          #code with possible error
      except:
           continue
      else:
           #the rest of the code
           break
  </code></pre>
  
  <p>This seems like a hack to me. Is there a more Pythonic way to do this?</p>