Jiri Danek created PROTON-1592:
----------------------------------
Summary: [proton-python] accessing properties of event.receiver in
on_link_opened throws exception
Key: PROTON-1592
URL: https://issues.apache.org/jira/browse/PROTON-1592
Project: Qpid Proton
Issue Type: Bug
Components: python-binding
Reporter: Jiri Danek
Apply the following patch to the {{tx-recv.py}} example
{code}
diff --git a/examples/python/tx_recv.py b/examples/python/tx_recv.py
index 4baddcf5..54f3b489 100755
--- a/examples/python/tx_recv.py
+++ b/examples/python/tx_recv.py
@@ -40,6 +40,9 @@ class TxRecv(MessagingHandler, TransactionHandler):
self.container.declare_transaction(self.conn, handler=self)
self.transaction = None
+ def on_link_opened(self, event):
+ event.receiver.drain_mode = True
+
def on_message(self, event):
print(event.message.body)
self.transaction.accept(event.delivery)
{noformat}
Now run first {{tx_send.py}}, then this {{tx_recv.py}}. The second command
throws exception
{noformat}
$ LD_LIBRARY_PATH=`pwd`/lib64 PYTHONPATH=`pwd`/lib64/proton/bindings/python
python ../examples/python/tx_recv.py
Traceback (most recent call last):
File "../examples/python/tx_recv.py", line 79, in <module>
Container(TxRecv(opts.address, opts.messages, opts.batch_size)).run()
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py",
line 148, in run
while self.process(): pass
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py",
line 174, in process
self._check_errors()
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py",
line 170, in _check_errors
_compat.raise_(exc, value, tb)
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
line 4068, in dispatch
ev.dispatch(self.handler)
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
line 3977, in dispatch
result = dispatch(handler, type.method, self)
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
line 3857, in dispatch
return handler.on_unhandled(method, *args)
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/reactor.py",
line 876, in on_unhandled
event.dispatch(handler)
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
line 3980, in dispatch
self.dispatch(h, type)
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
line 3977, in dispatch
result = dispatch(handler, type.method, self)
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
line 3855, in dispatch
return m(*args)
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/handlers.py",
line 298, in on_link_remote_open
self.on_link_opened(event)
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/handlers.py",
line 313, in on_link_opened
dispatch(self.delegate, 'on_link_opened', event)
File
"/home/jdanek/Work/repos/qpid-proton/install/lib64/proton/bindings/python/proton/__init__.py",
line 3855, in dispatch
return m(*args)
File "../examples/python/tx_recv.py", line 44, in on_link_opened
event.receiver.drain_mode = True
AttributeError: 'NoneType' object has no attribute 'drain_mode'
{noformat}
To see this is a regression, repeat now with python-qpid-proton 0.17.0 from
Pypi. With this previous release, there is success.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]