title: Python: How to try again when experiencing a timeout
body: <p>I have a Python program that connects to a server to send it some commands, but occasionally I get this error:</p>
  <blockquote>
  <p>TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond</p>
  </blockquote>
  <p>In previous situations like this, I would use something like this:</p>
  <pre><code>try:
              Do something
          except KeyError:
              do something else
  </code></pre>
  <p>Could I do the same thing in this same situation? I.e.,</p>
  <pre><code>try:
                  Do something
              except TimeoutError:
                 Do something again
  </code></pre>
  <p>And if so, what would I do after the except TimeoutError? Would I just do the same command again?</p>