diff --git a/examples/ecs/ecs/tk_echo_client.py b/examples/ecs/ecs/tk_echo_client.py index 632da14..1e4727d 100644 --- a/examples/ecs/ecs/tk_echo_client.py +++ b/examples/ecs/ecs/tk_echo_client.py @@ -172,13 +172,13 @@ def get_message(self): self.root.destroy() self.publisher.close() self.subscriber.close() - self.context.term() + self.my_context.term() sys.exit(0) except KeyboardInterrupt: self.root.destroy() self.publisher.close() self.subscriber.close() - self.context.term() + self.my_context.term() sys.exit(0) def incoming_message_processing(self, topic, payload): diff --git a/examples/tk_echo_client.py b/examples/tk_echo_client.py index 2590784..3b252c4 100644 --- a/examples/tk_echo_client.py +++ b/examples/tk_echo_client.py @@ -33,7 +33,7 @@ import tkFont as font import ttk -import umsgpack +import msgpack import zmq from python_banyan.banyan_base import BanyanBase @@ -158,7 +158,7 @@ def get_message(self): """ try: data = self.subscriber.recv_multipart(zmq.NOBLOCK) - self.incoming_message_processing(data[0].decode(), umsgpack.unpackb(data[1])) + self.incoming_message_processing(data[0].decode(), msgpack.unpackb(data[1])) time.sleep(.001) self.root.after(1, self.get_message) @@ -171,13 +171,13 @@ def get_message(self): self.root.destroy() self.publisher.close() self.subscriber.close() - self.context.term() + self.my_context.term() sys.exit(0) except KeyboardInterrupt: self.root.destroy() self.publisher.close() self.subscriber.close() - self.context.term() + self.my_context.term() sys.exit(0) def incoming_message_processing(self, topic, payload): diff --git a/python_banyan/banyan_base/banyan_base.py b/python_banyan/banyan_base/banyan_base.py index 84fe3fc..6b777dc 100644 --- a/python_banyan/banyan_base/banyan_base.py +++ b/python_banyan/banyan_base/banyan_base.py @@ -145,12 +145,12 @@ def __init__(self, back_plane_ip_address=None, subscriber_port='43125', print('************************************************************') # establish the zeromq sub and pub sockets and connect to the backplane - self.context = zmq.Context() - self.subscriber = self.context.socket(zmq.SUB) + self.my_context = zmq.Context() + self.subscriber = self.my_context.socket(zmq.SUB) connect_string = "tcp://" + self.back_plane_ip_address + ':' + self.subscriber_port self.subscriber.connect(connect_string) - self.publisher = self.context.socket(zmq.PUB) + self.publisher = self.my_context.socket(zmq.PUB) connect_string = "tcp://" + self.back_plane_ip_address + ':' + self.publisher_port self.publisher.connect(connect_string) @@ -251,7 +251,7 @@ def clean_up(self): """ self.publisher.close() self.subscriber.close() - self.context.term() + self.my_context.term() # When creating a derived component, replicate the code below and replace # banyan_base with a name of your choice. diff --git a/python_banyan/banyan_base_aio/banyan_base_aio.py b/python_banyan/banyan_base_aio/banyan_base_aio.py index 72a664e..7c87660 100644 --- a/python_banyan/banyan_base_aio/banyan_base_aio.py +++ b/python_banyan/banyan_base_aio/banyan_base_aio.py @@ -90,7 +90,7 @@ def __init__(self, back_plane_ip_address=None, subscriber_port='43125', self.receive_loop_idle_addition = receive_loop_idle_addition self.connect_time = connect_time self.subscriber_list = subscriber_list - self.context = None + self.my_context = None self.subscriber = None self.publisher = None self.the_task = None @@ -152,14 +152,14 @@ def __init__(self, back_plane_ip_address=None, subscriber_port='43125', # noinspection PyUnresolvedReferences async def begin(self): # establish the zeromq sub and pub sockets and connect to the backplane - if not self.context: - self.context = zmq.asyncio.Context() + if not self.my_context: + self.my_context = zmq.asyncio.Context() # noinspection PyUnresolvedReferences - self.subscriber = self.context.socket(zmq.SUB) + self.subscriber = self.my_context.socket(zmq.SUB) connect_string = "tcp://" + self.back_plane_ip_address + ':' + self.subscriber_port self.subscriber.connect(connect_string) - self.publisher = self.context.socket(zmq.PUB) + self.publisher = self.my_context.socket(zmq.PUB) connect_string = "tcp://" + self.back_plane_ip_address + ':' + self.publisher_port self.publisher.connect(connect_string) @@ -275,4 +275,4 @@ async def clean_up(self): """ await self.publisher.close() await self.subscriber.close() - await self.context.term() + await self.my_context.term() diff --git a/python_banyan/banyan_base_multi/banyan_base_multi.py b/python_banyan/banyan_base_multi/banyan_base_multi.py index c8577d6..2dc349c 100644 --- a/python_banyan/banyan_base_multi/banyan_base_multi.py +++ b/python_banyan/banyan_base_multi/banyan_base_multi.py @@ -107,7 +107,7 @@ def __init__(self, back_plane_csv_file=None, process_name='None', self.loop_time = loop_time # get a zeromq context - self.context = zmq.Context() + self.my_context = zmq.Context() # a list of dictionaries describing connections to the back planes self.backplane_table = [] @@ -128,13 +128,13 @@ def __init__(self, back_plane_csv_file=None, process_name='None', # setup a publisher and subscriber for each backplane subscriber = None if row['subscriber_port']: - subscriber = self.context.socket(zmq.SUB) + subscriber = self.my_context.socket(zmq.SUB) connect_string = "tcp://" + row['ip_address'] + ':' + row['subscriber_port'] subscriber.connect(connect_string) publisher = None if row['publisher_port']: - publisher = self.context.socket(zmq.PUB) + publisher = self.my_context.socket(zmq.PUB) connect_string = "tcp://" + row['ip_address'] + ':' + row['publisher_port'] publisher.connect(connect_string) @@ -337,7 +337,7 @@ def clean_up(self): element['publisher'].close() if element['subscriber']: element['subscriber'].close() - self.context.term() + self.my_context.term() # When creating a derived component, replicate the code below and replace banyan_base_multi with a name of your choice diff --git a/setup.py b/setup.py index b2717c3..f5f4208 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name='python-banyan', - version='3.8', + version='3.9', packages=[ 'python_banyan', 'python_banyan.banyan_base',