diff options
author | Casey Deccio <casey@deccio.net> | 2021-08-06 08:49:58 +0300 |
---|---|---|
committer | Casey Deccio <casey@deccio.net> | 2021-08-06 08:49:58 +0300 |
commit | 7727f0952ad5f62a16ba5f534f58d4d2c6e6d338 (patch) | |
tree | 8d9e0d909de81cd0307d5f9a5fdcf841283f71de | |
parent | 25503d1c859f262074a9a9f6b16053530213789d (diff) |
Make compatible with python2.7
-rw-r--r-- | dnsviz/transport.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/dnsviz/transport.py b/dnsviz/transport.py index 8d46c3c..cff09ab 100644 --- a/dnsviz/transport.py +++ b/dnsviz/transport.py @@ -1403,7 +1403,14 @@ class _DNSQueryTransportManager: self._event_map = {} self._close = threading.Event() - t = threading.Thread(target=self._loop, daemon=True) + # python3/python2 dual compatibility + try: + # python 3 + t = threading.Thread(target=self._loop, daemon=True) + except TypeError: + # python 2 + t = threading.Thread(target=self._loop) + t.daemon = True t.start() def close(self): |