From b9ffeadeb01e8db1e5d07dceea47784ba36740e6 Mon Sep 17 00:00:00 2001 From: Alessandro Molina Date: Mon, 20 Aug 2018 17:20:10 -0400 Subject: [PATCH] Fixes for Python3 --- magicbus/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/magicbus/base.py b/magicbus/base.py index 9a299d8e..75a16a6e 100644 --- a/magicbus/base.py +++ b/magicbus/base.py @@ -166,7 +166,7 @@ def __init__(self, transitions=None, errors=None, self.listeners[c] = set() if id is None: - id = hex(random.randint(0, sys.maxint))[-8:] + id = hex(random.randint(0, sys.maxsize))[-8:] self.id = id self._priorities = {} self._state_transition_pipes = set() @@ -202,7 +202,7 @@ def _transition(self, newstate, *args, **kwargs): # Write to any pipes created by threads calling self.wait(). # Use list() to avoid "Set changed size during iteration" errors. for read_fd, write_fd in list(self._state_transition_pipes): - os.write(write_fd, "1") + os.write(write_fd, b"1") # Note: logging here means 1) the initial transition # will not be logged if loggers are set up in the initial