Jiri Danek created PROTON-1417:
----------------------------------
Summary: [python] TypeError on listener when handling address
already in use
Key: PROTON-1417
URL: https://issues.apache.org/jira/browse/PROTON-1417
Project: Qpid Proton
Issue Type: Bug
Components: python-binding
Affects Versions: 0.18.0
Reporter: Jiri Danek
Priority: Minor
There is a wrong syntax in exception handling code when raising the "Address
already in use" error in _proton-c/bindings/python/proton/reactor.py_ (line
179):
{code}
raise IOError("%s (%s:%s)" % pn_error_text(pn_reactor_error(self._impl)), host,
port)
{code}
Which leads to unexpected TypeError:
{code}
Traceback (most recent call last):
File "in_handler.py", line 15, in <module>
container.run()
File "/usr/lib64/python2.7/site-packages/proton/reactor.py", line 133, in run
while self.process(): pass
File "/usr/lib64/python2.7/site-packages/proton/reactor.py", line 159, in
process
self._check_errors()
File "/usr/lib64/python2.7/site-packages/proton/reactor.py", line 155, in
_check_errors
_compat.raise_(exc, value, tb)
File "/usr/lib64/python2.7/site-packages/proton/__init__.py", line 4040, in
dispatch
ev.dispatch(self.handler)
File "/usr/lib64/python2.7/site-packages/proton/__init__.py", line 3949, in
dispatch
result = dispatch(handler, type.method, self)
File "/usr/lib64/python2.7/site-packages/proton/__init__.py", line 3827, in
dispatch
return m(*args)
File "/usr/lib64/python2.7/site-packages/proton/handlers.py", line 436, in
on_reactor_init
self.on_start(event)
File "in_handler.py", line 6, in on_start
acceptor = event.container.listen("localhost:5672")
File "/usr/lib64/python2.7/site-packages/proton/reactor.py", line 869, in
listen
acceptor = self.acceptor(url.host, url.port)
File "/usr/lib64/python2.7/site-packages/proton/reactor.py", line 179, in
acceptor
raise IOError("%s (%s:%s)" % pn_error_text(pn_reactor_error(self._impl)),
host, port)
TypeError: not enough arguments for format string
{code}
Proposed fix:
{code}
diff --git a/proton-c/bindings/python/proton/reactor.py
b/proton-c/bindings/python/proton/reactor.py
index 269ed9e..a0699c8 100644
--- a/proton-c/bindings/python/proton/reactor.py
+++ b/proton-c/bindings/python/proton/reactor.py
@@ -176,7 +176,7 @@ class Reactor(Wrapper):
if aimpl:
return Acceptor(aimpl)
else:
- raise IOError("%s (%s:%s)" %
pn_error_text(pn_reactor_error(self._impl)), host, port)
+ raise IOError("%s (%s:%s)" %
(pn_error_text(pn_reactor_error(self._impl)), host, port))
def connection(self, handler=None):
"""Deprecated: use connection_to_host() instead
{code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]