Self-Restarting Script in Python on Windows
<p>I have a script that is communicating with an outside server that sometimes throws out errors and mucks up my program. I have tried to workaround it, but it seems like it keeps throwing errors unless I manually restart the program.</p>

<p>Is there any way on Windows to have a python script restart itself on error? I see this ox.exec whenever I search these types of things and just can't seem to figure out making it work</p>

<pre><code>In my main code: 
except:
    print "Unexpected error:", sys.exc_info()[0]
    logout()



def logout():
gv.logout()
time.sleep(20)
login()



def login():
try:
    gv.login(settings.user,settings.passw)
    textcheck()
except:
    print "Unexpected error:", sys.exc_info()[0]
    time.sleep(30)
    login()
</code></pre>
