Skip to content

Commit bc6e232

Browse files
committed
fix(__init__): only import Broker for python>2
The broker uses asyncio, which does not exist in python2. For python2 scripts to use the manager, make the broker import in __init__ depending on the python (major) version.
1 parent 8d979c5 commit bc6e232

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

comet/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
"""CoMeT: A Config and Metadata Tracker."""
22
from .version import __version__
3-
from .broker import Broker
43
from .manager import Manager, ManagerError, BrokerError, CometError
4+
5+
# The broker uses asyncio which doesn't exist in python2. However we want to be able to use the
6+
# manager in python2, so make the Broker import dependent on the python version.
7+
from sys import version_info
8+
if version_info.major > 2:
9+
from .broker import Broker

0 commit comments

Comments
 (0)