How do I automatically restart my python code after it exits on an error?
<p>The following doesn't work. I have a program that connects to a web page, but sometimes due to some problems it can't connect I want the program to completely restart after the error all by it self. Imagine the main function calls the program, how can I write such a code?</p>

<pre><code>import numpy as np

def main():
    np.load('File.csv')

for i in range(1, 10):
    try:
        main()
    except Exception as e:
        print e
        print 'Restarting!'
        main()
</code></pre>