From 55b92dffbbae747cda6ff93e8bcb1e5e21658ab6 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Sun, 12 Jun 2022 02:14:19 +0300 Subject: [PATCH] Wrap import of BMConnectionPool and AnnounceThread into try: .. except: for partial testing on python3. --- src/network/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/network/__init__.py b/src/network/__init__.py index 269bd298..1b5aef92 100644 --- a/src/network/__init__.py +++ b/src/network/__init__.py @@ -2,17 +2,21 @@ Network subsystem package """ -from .connectionpool import BMConnectionPool +try: + from .announcethread import AnnounceThread + from .connectionpool import BMConnectionPool +except ImportError: + AnnounceThread = None + BMConnectionPool = None from .threads import StoppableThread -__all__ = ["BMConnectionPool", "StoppableThread"] +__all__ = ["AnnounceThread", "BMConnectionPool", "StoppableThread"] def start(config, state): """Start network threads""" from .addrthread import AddrThread - from .announcethread import AnnounceThread from .dandelion import Dandelion from .downloadthread import DownloadThread from .invthread import InvThread