Make sure the monkey patching stuff gevent requires is imported at start, so we dont get an exception on close time

This commit is contained in:
Jan Klopper 2016-09-09 13:04:12 +02:00
parent 2bc9ff5ca4
commit 59a9a06952

View file

@ -8,6 +8,11 @@ code from https://github.com/defnull/pixelflut/
__version__ = 0.3
__author__ = "Jan Klopper <jan@underdark.nl>"
if __name__ == '__main__':
# avoid nasty eception on python closing time
from gevent import spawn, monkey
monkey.patch_all()
import struct
import time
import socket
@ -301,11 +306,6 @@ def RunServer(options):
options=options).serve_forever()
if __name__ == '__main__':
# import gevent monkeypatching and perform patch_all before anything else to
# avoid nasty eception on python closing time
from gevent import spawn, monkey
monkey.patch_all()
import pygame
from pygame import locals as pygamelocals