Remove deprecated PyZMQ call from Python ZMQ example

PyZMQ 17.0.0 has deprecated and removed zmq.asyncio.install() call
with advice to use asyncio native run-loop instead of zmq specific.

This caused exception when running the contrib/zmq/zmq_sub*.py examples.

This commit simply follows the advice.
This commit is contained in:
Michał Zabielski 2018-03-03 06:05:53 +01:00
parent 90a0aed511
commit 6058766de4
2 changed files with 2 additions and 2 deletions

2
contrib/zmq/zmq_sub.py Executable file → Normal file
View file

@ -38,7 +38,7 @@ port = 28332
class ZMQHandler(): class ZMQHandler():
def __init__(self): def __init__(self):
self.loop = zmq.asyncio.install() self.loop = asyncio.get_event_loop()
self.zmqContext = zmq.asyncio.Context() self.zmqContext = zmq.asyncio.Context()
self.zmqSubSocket = self.zmqContext.socket(zmq.SUB) self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)

2
contrib/zmq/zmq_sub3.4.py Executable file → Normal file
View file

@ -42,7 +42,7 @@ port = 28332
class ZMQHandler(): class ZMQHandler():
def __init__(self): def __init__(self):
self.loop = zmq.asyncio.install() self.loop = asyncio.get_event_loop()
self.zmqContext = zmq.asyncio.Context() self.zmqContext = zmq.asyncio.Context()
self.zmqSubSocket = self.zmqContext.socket(zmq.SUB) self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)