summaryrefslogtreecommitdiffstats
path: root/Lasers_und_stuff/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lasers_und_stuff/main.py')
-rw-r--r--Lasers_und_stuff/main.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/Lasers_und_stuff/main.py b/Lasers_und_stuff/main.py
index b296528..0b61c0d 100644
--- a/Lasers_und_stuff/main.py
+++ b/Lasers_und_stuff/main.py
@@ -8,6 +8,8 @@ Created on Nov 10, 2012
import random, pygame, sys
import flask
import threading
+import os
+import signal
from pygame.locals import *
from Cannon import CannonController
from Cannon import Gunpoint
@@ -178,9 +180,20 @@ class Screen:
if __name__ == '__main__':
- t = threading.Thread(target=main)
+ def pygame_runner():
+ try:
+ main()
+ except Exception as e:
+ print "Pygame thread raised exception %s" % str(e)
+ os.kill(os.getpid(), signal.SIGINT)
+ t = threading.Thread(target=pygame_runner)
+
def flask_runner():
- app.run(use_reloader=False)
+ try:
+ app.run(use_reloader=False)
+ except Exception as e:
+ print "Flask thread raised exception %s" % str(e)
+ os.kill(os.getpid(), signal.SIGINT)
t2 = threading.Thread(target=flask_runner)
print "Starting pygame..."