Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Cancel' object has no attribute 'reply_code' #419

Closed
vitaly-krugl opened this issue Nov 8, 2013 · 2 comments
Closed

AttributeError: 'Cancel' object has no attribute 'reply_code' #419

vitaly-krugl opened this issue Nov 8, 2013 · 2 comments

Comments

@vitaly-krugl
Copy link
Member

pika version: '0.9.13'

Using BlockingConnection.

Got this traceback that is indicative of ConsumerCancelledException's repr method is attempting to access a non-existent attribute of the Cancel instance:

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/handlers.py", line 77, in emit
    if self.shouldRollover(record):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/handlers.py", line 156, in shouldRollover
    msg = "%s\n" % self.format(record)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 719, in format
    return fmt.format(record)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 464, in format
    record.message = record.getMessage()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 328, in getMessage
    msg = msg % self.args
  File "/Users/vkruglikov/nta/nupic-darwin64/nta/eng/lib/python2.7/site-packages/pika/exceptions.py", line 76, in __repr__
    return 'Server cancelled consumer (%s): %s' % (self.args[0].reply_code,
AttributeError: 'Cancel' object has no attribute 'reply_code'

The errant source code is:

class ConsumerCancelled(AMQPChannelError):
    def __repr__(self):
        return 'Server cancelled consumer (%s): %s' % (self.args[0].reply_code,
                                                       self.args[0].reply_text)
@vitaly-krugl
Copy link
Member Author

Closing: cannot reproduce with 24c3f1d

@vitaly-krugl
Copy link
Member Author

Actually, it's still a problem in the latest pika master:

in ConsumerCancelled. __repr__(), self.args[0] is a Basic.Cancel instance, which has no reply_code attribute, so ConsumerCancelled. __repr__() blows up when it tries to access it: AttributeError: 'Cancel' object has no attribute 'reply_code'

CANCEL EXC ARGS: (<Basic.Cancel(['consumer_tag=ctag1.f6d7b8c88344417b99c8a5416c4a6c70', 'nowait=True'])>,) DIR args[0]: ['INDEX', 'NAME', 'class', 'delattr', 'dict', 'doc', 'format', 'getattribute', 'hash', 'init', 'module', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_set_content', 'consumer_tag', 'decode', 'encode', 'get_body', 'get_properties', 'nowait', 'synchronous']

gmr added a commit that referenced this issue Feb 17, 2014
gmr added a commit that referenced this issue Feb 17, 2014
Basic.Cancel does not have reply_code or reply_text.
@gmr gmr closed this as completed Feb 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants