[rabbitmq-discuss] NotImplementedError: <class 'pika.spec.CancelOk'>

Matt Pietrek mpietrek at hotmail.com
Tue Aug 16 17:51:50 BST 2011


Thanks for the quick reply Gavin.

I've got no idea how my install would be non-standard. It's an Ubuntu 11.04
box, recently updated via "sudo apt-get upgrade". FWIW, my Python 2.7
install is based in /usr/local/lib/python2.7, so the /local/ in the path
isn't surprising (to me at least...)

Per the instructions on the RabbitMq site, I did: "sudo pip install
pika==0.9.5". I didn't notice any errors:

----------------
mpietrek at rabbitmq:/usr/local/lib/python2.7$sudo pip install pika==0.9.5
Downloading/unpacking pika==0.9.5
  Downloading pika-0.9.5.tar.gz
  Running setup.py egg_info for package pika
    
Installing collected packages: pika
  Running setup.py install for pika
    
Successfully installed pika
Cleaning up...
----------------

The output from Interactive Python that you requested:

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pika
>>> pika.__version__
'0.9.5'

Also, FWIW, the contents of
/usr/local/lib/python2.7/dist-packages/pika-0.9.5.egg-info/PKG_INFO are:

Metadata-Version: 1.0
Name: pika
Version: 0.9.5
Summary: Pika Python AMQP Client Library
Home-page: http://pika.github.com/
Author: Gavin M. Roy
Author-email: gmr at myyearbook.com
License: MPL v1.1 and GPL v2.0 or newer
Description: Pika is a pure-Python implementation of the AMQP 0-9-1 protocol
that
        tries to stay fairly independent of the underlying network support
        library. Pika was developed primarily for use with RabbitMQ, but
        should also work with other AMQP 0-9-1 brokers.
        
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1)
Classifier: Operating System :: OS Independent
Classifier: Topic :: Communications
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries

Thanks much for your help,

Matt

From:  "Gavin M. Roy" <gmr at myyearbook.com>
Date:  Tue, 16 Aug 2011 12:32:44 -0400
To:  Matt Pietrek <mpietrek at hotmail.com>
Cc:  Marek Majkowski <majek04 at gmail.com>,
<rabbitmq-discuss at lists.rabbitmq.com>
Subject:  Re: [rabbitmq-discuss] NotImplementedError: <class
'pika.spec.CancelOk'>

 
 It looks like to me that you have a non-standard pika install, perhaps the
new debian package?

I say that because I see:

>>> /usr/local/lib/python2.7/dist-packages/pika/connection.py
And I'd expect something like:

/usr/lib/python2.7/site-packages/pika/connection.py

Can you use slocate or find to see if you have more than one version of pika
installed?

What happens when you run the following in python2.7 interactively?

import pika
pika.__version__
 
 
  

On Tuesday, August 16, 2011 at 12:18 PM, Matt Pietrek wrote:
 
>  
> Alas, no luck with a Pika reinstall. I did a "pip uninstall" of what was
> there, verified the files were removed, then "pip install".
> 
> All other aspects of my Pika-based code seem to work. I'm sending and
> receiving 1000's of messages before shutting down. It's only at shutdown
> where the problem occurs.
> 
> Does my shutdown sequence look OK? That is, calling
> channel.stop_consuming() from a different thread than I called
> .start_consuming on?
> 
> 
> 
> On 8/16/11 4:29 AM, "Marek Majkowski" <majek04 at gmail.com> wrote:
> 
>> On Tue, Aug 16, 2011 at 00:36, Matt Pietrek <mpietrek at hotmail.com> wrote:
>>> I'm getting the following error from code that used to work without
>>> error until I did an "apt-get upgrade" today.
>>> 
>>> This is an Ubuntu 11.04 system running Python 2.7 and Pika 0.95. Any
>>> clues what's happening?
>> 
>> Nope. Maybe it's just a python installation issue?
>> 
>> Can you try removing pika and installing it again? Or maybe
>> installing a fresh local copy (for example using venv)?
>> 
>> Cheers,
>>  Marek
>> 
>>> Traceback (most recent call last):
>>>  File "/usr/lib/python2.7/threading.py", line 552, in
>>> __bootstrap_inner
>>>    self.run()
>>>  File "ConfigMgr.py", line 101, in run
>>>    self.channel.start_consuming()
>>>  File "/usr/local/lib/python2.7/dist-packages/pika/adapters/
>>> blocking_connection.py", line 293, in start_consuming
>>>    self.transport.connection.process_data_events()
>>>  File "/usr/local/lib/python2.7/dist-packages/pika/adapters/
>>> blocking_connection.py", line 94, in process_data_events
>>>    self._handle_read()
>>>  File "/usr/local/lib/python2.7/dist-packages/pika/adapters/
>>> base_connection.py", line 162, in _handle_read
>>>    self._on_data_available(data)
>>>  File "/usr/local/lib/python2.7/dist-packages/pika/connection.py",
>>> line 599, in _on_data_available
>>>    self._channels[frame.channel_number].transport.deliver(frame)
>>>  File "/usr/local/lib/python2.7/dist-packages/pika/channel.py", line
>>> 64, in deliver
>>>    self.frame_dispatcher.process(frame)
>>>  File "/usr/local/lib/python2.7/dist-packages/pika/frame.py", line
>>> 202, in process
>>>    self._handler(frame)
>>>  File "/usr/local/lib/python2.7/dist-packages/pika/frame.py", line
>>> 220, in _handle_method_frame
>>>    raise NotImplementedError(frame.method.__class__)
>>> NotImplementedError: <class 'pika.spec.CancelOk'>
>>> 
>>> Here's what my code looks like:
>>> 
>>> class ListenForLongRunningEventCompletion(threading.Thread):
>>>    def run(self):
>>>        self.connection =
>>> pika.BlockingConnection(pika.ConnectionParameters(host=MQ_BINDING))
>>>        self.channel = self.connection.channel()
>>> 
>>>        self.channel.queue_declare(queue=RESPONSE_QUEUE_NAME)
>>>        self.channel.basic_consume(ResponseCallback,
>>>                              queue=RESPONSE_QUEUE_NAME,
>>>                              no_ack=True)
>>>        self.channel.start_consuming()
>>> 
>>>    def shutdown(self):
>>>        self.channel.stop_consuming()
>>> 
>>> def ResponseCallback(ch, method, properties, body):
>>>    print "Long Running Task response({0})".format(body)
>>> 
>>> 
>>> #========================================================================
>>> ======
>>> #
>>> # Main program
>>> #
>>> 
>>> #========================================================================
>>> ======
>>> 
>>> if __name__ == '__main__':
>>>    listener = ListenForLongRunningEventCompletion()
>>>    listener.start()
>>> 
>>>    # Main app logic - not important here
>>> 
>>>    # Shut down the connections we've opened up
>>>    listener.shutdown()
>>> _______________________________________________
>>> rabbitmq-discuss mailing list
>>> rabbitmq-discuss at lists.rabbitmq.com
>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
> 
> 
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>      
  
 
 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110816/aff6b60d/attachment.htm>


More information about the rabbitmq-discuss mailing list