Merge #12588: [Utils] Remove deprecated PyZMQ call from Python ZMQ example

6058766de Remove deprecated PyZMQ call from Python ZMQ example (Michał Zabielski)

Pull request description:

  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 and fixes mentioned examples.

Tree-SHA512: af357aafa5eb9506cfa3f513f06979bbc49f6132fddc1e96fbcea175da4f8e2ea298be7c7055e7d3377f0814364e13bb88b5c195f6a07898cd28c341d23a93c5
This commit is contained in:
Wladimir J. van der Laan 2018-03-06 19:02:57 +01:00
commit d74b01db0c
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D
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)