From de4d5b51e5fc8ba0d0f904851f23f8cced16d7f6 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Mon, 19 Dec 2022 17:44:10 +0100 Subject: [PATCH] Do not automatically import zmq --- src/socketio/zmq_manager.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/socketio/zmq_manager.py b/src/socketio/zmq_manager.py index 54538cf..ec36060 100644 --- a/src/socketio/zmq_manager.py +++ b/src/socketio/zmq_manager.py @@ -1,11 +1,6 @@ import pickle import re -try: - import eventlet.green.zmq as zmq -except ImportError: - zmq = None - from .pubsub_manager import PubSubManager @@ -51,7 +46,9 @@ class ZmqManager(PubSubManager): # pragma: no cover channel='socketio', write_only=False, logger=None): - if zmq is None: + try: + from eventlet.green import zmq + except ImportError: raise RuntimeError('zmq package is not installed ' '(Run "pip install pyzmq" in your ' 'virtualenv).')