Code no longer works after going from Python 2.7 to 3.3
<p>I started using Python 3.3 instead of 2.7 and there is a problem with some lines of code that I use to restart or close the program.</p>

<pre><code>def restart_program(): 
    python = sys.executable
    os.execl(python, python, * sys.argv)

if __name__ == "__main__":
    answer = input("Restart or close program    ")
    if answer.strip() in "Restart restart".split():
        restart_program()
</code></pre>

<p>When I use this I get the following error:</p>

<pre><code>Fatal Python error: PyEval_RestoreThread: NULL tstate
Current thread 0x00002030:
File "C:\Python33\lib\os.py", line 531 in execl
File "C:\Users\user\desktop\filename", line 66 in restart_program
</code></pre>

<p>Line 66 is</p>

<pre><code>os.execl(python, python, * sys.argv)
</code></pre>

<p>I have no idea how to solve this and I really hope that someone has a solution.</p>

<p>If I write something really easy like the following code, then it works with no problems.</p>

<pre><code>import math
import os
import sys

a = input ("enter a")
a = float (a)
b = 12

x = a+b
print (x)

def restart_program(): 
    python = sys.executable
    os.execl(python, python, * sys.argv)

if __name__ == "__main__":
    answer = input("Restart or close the program    ")
    if answer.strip() in ["Restart", "restart"]:
        restart_program()
</code></pre>

<p>I guess I could also add my entire code here.</p>

<p><a href="http://pastebin.com/fM8s0iiw" rel="nofollow">http://pastebin.com/fM8s0iiw</a></p>
