From 59a9a0695253c6310ffb04036bfc35b58833b784 Mon Sep 17 00:00:00 2001 From: Jan Klopper Date: Fri, 9 Sep 2016 13:04:12 +0200 Subject: [PATCH] Make sure the monkey patching stuff gevent requires is imported at start, so we dont get an exception on close time --- vloed.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vloed.py b/vloed.py index 145723c..701984c 100755 --- a/vloed.py +++ b/vloed.py @@ -8,6 +8,11 @@ code from https://github.com/defnull/pixelflut/ __version__ = 0.3 __author__ = "Jan Klopper " +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