[rabbitmq-discuss] First Python sample (send.py) gives error: AttributeError: 'ProtocolHeader' object has no attribute 'channel_number'

Matt Pietrek mpietrek at skytap.com
Fri Jul 1 19:26:46 BST 2011


Hmm.. Perhaps it is an old version (1.7.2?). However, not sure how I got
it, given that I installed just yesterday. To be sure, I ran the
following, which does not seem to get me the latest:

foo at foo:~$ sudo apt-get update
Hit http://security.ubuntu.com lucid-security Release.gpg
Ign http://security.ubuntu.com/ubuntu/ lucid-security/main
Translation-en_US
Ign http://security.ubuntu.com/ubuntu/ lucid-security/restricted
Translation-en_US
Hit http://us.archive.ubuntu.com lucid Release.gpg
Ign http://us.archive.ubuntu.com/ubuntu/ lucid/main Translation-en_US
Ign http://us.archive.ubuntu.com/ubuntu/ lucid/restricted Translation-en_US
Ign http://security.ubuntu.com/ubuntu/ lucid-security/universe
Translation-en_US
Ign http://security.ubuntu.com/ubuntu/ lucid-security/multiverse
Translation-en_US
Hit http://security.ubuntu.com lucid-security Release
Ign http://us.archive.ubuntu.com/ubuntu/ lucid/universe Translation-en_US
Ign http://us.archive.ubuntu.com/ubuntu/ lucid/multiverse Translation-en_US
Hit http://us.archive.ubuntu.com lucid-updates Release.gpg
Ign http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main
Translation-en_US
Ign http://us.archive.ubuntu.com/ubuntu/ lucid-updates/restricted
Translation-en_US
Ign http://us.archive.ubuntu.com/ubuntu/ lucid-updates/universe
Translation-en_US
Ign http://us.archive.ubuntu.com/ubuntu/ lucid-updates/multiverse
Translation-en_US
Hit http://us.archive.ubuntu.com lucid Release
Hit http://us.archive.ubuntu.com lucid-updates Release
Hit http://security.ubuntu.com lucid-security/main Packages
Hit http://us.archive.ubuntu.com lucid/main Packages
Hit http://us.archive.ubuntu.com lucid/restricted Packages
Hit http://us.archive.ubuntu.com lucid/main Sources
Hit http://us.archive.ubuntu.com lucid/restricted Sources
Hit http://us.archive.ubuntu.com lucid/universe Packages
Hit http://us.archive.ubuntu.com lucid/universe Sources
Hit http://security.ubuntu.com lucid-security/restricted Packages
Hit http://security.ubuntu.com lucid-security/main Sources
Hit http://security.ubuntu.com lucid-security/restricted Sources
Hit http://security.ubuntu.com lucid-security/universe Packages
Hit http://security.ubuntu.com lucid-security/universe Sources
Hit http://security.ubuntu.com lucid-security/multiverse Packages
Hit http://us.archive.ubuntu.com lucid/multiverse Packages
Hit http://us.archive.ubuntu.com lucid/multiverse Sources
Hit http://security.ubuntu.com lucid-security/multiverse Sources
Hit http://us.archive.ubuntu.com lucid-updates/main Packages
Hit http://us.archive.ubuntu.com lucid-updates/restricted Packages
Hit http://us.archive.ubuntu.com lucid-updates/main Sources
Hit http://us.archive.ubuntu.com lucid-updates/restricted Sources
Hit http://us.archive.ubuntu.com lucid-updates/universe Packages
Hit http://us.archive.ubuntu.com lucid-updates/universe Sources
Hit http://us.archive.ubuntu.com lucid-updates/multiverse Packages
Hit http://us.archive.ubuntu.com lucid-updates/multiverse Sources
Reading package lists... Done

highland at highland-desktop:~$ apt-show-versions | grep rabbitmq
rabbitmq-server/lucid uptodate 1.7.2-1ubuntu1

highland at highland-desktop:~$ sudo apt-get install rabbitmq-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
rabbitmq-server is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 278 not upgraded.
highland at highland-desktop:~$


I'm going to try explicitly attaching to the RabbitMQ APT, per the
directions, but I'd think the standard Ubuntu repositories would be up to
date. Either that, or I'm overlooking something beyond my current Linux
skills.



On 7/1/11 10:48 AM, "Marek Majkowski" <majek04 at gmail.com> wrote:

>Right,
>
>Google says it may be due to an outdated version of RabbitMQ.
>
>Can you make sure you're using RabbitMQ > 2.0 ?
>
>Explanation: rabbitmq < 2.0 spoke AMQP 0-8,
>recent pika and recent RabbitMQ speak AMQP 0-9-1.
>
>Cheers,
>  Marek
>
>On Fri, Jul 1, 2011 at 18:14, Matt Pietrek <mpietrek at skytap.com> wrote:
>> Mark,
>>
>> Thanks for getting back to me.
>>
>> Yes, I installed it exactly as specified on the tutorial page. I
>> copied/pasted the command line.
>>
>> Just to be sure, I ran it again and got this output:
>>
>> foo at foo:~$ sudo pip install -e
>> git+http://github.com/pika/pika.git@v0.9.5#egg=pika-v0.9.5
>> Checking out pika-v0.9.5 from
>> git+http://github.com/pika/pika.git@v0.9.5#egg=pika-v0.9.5 checkout from
>> git+http://github.com/pika/pika.git@v0.9.5#egg=pika-v0.9.5
>>  Cloning http://github.com/pika/pika.git (to revision v0.9.5) to
>> ./src/pika-v0.9.5
>>  Running setup.py egg_info for package pika-v0.9.5
>> Installing collected packages: pika-v0.9.5
>>  Running setup.py develop for pika-v0.9.5
>>    Creating /usr/local/lib/python2.6/dist-packages/pika.egg-link (link
>>to
>> .)
>>    Adding pika 0.9.5 to easy-install.pth file
>>
>>    Installed /home/highland/src/pika-v0.9.5
>> Successfully installed pika-v0.9.5
>>
>>
>> On 7/1/11 3:22 AM, "Marek Majkowski" <majek04 at gmail.com> wrote:
>>
>>>Matt,
>>>
>>>Looks like you have a wrong version of pika.
>>>
>>>Are you sure you have pika 0.9.5 exactly?
>>>
>>>Have you installed it as suggested on the tutorial page, using pip:
>>>   pip install -e
>>>git+http://github.com/pika/pika.git@v0.9.5#egg=pika-v0.9.5
>>>
>>>Cheers!
>>>  Marek
>>>
>>>On Thu, Jun 30, 2011 at 23:13, Matt Pietrek <mpietrek at skytap.com> wrote:
>>>> I've just now followed the directions verbatim from
>>>> here: http://www.rabbitmq.com/tutorials/tutorial-one-python.html
>>>> I've copied/pasted the sample code for send.py and receive.py directly
>>>>from
>>>> the web page so as to eliminate errors. Unfortunately, I'm getting the
>>>> following error:
>>>>
>>>> foo at foo-desktop:~/rabbitmq-test$ python send.py
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>>   File "send.py", line 4, in <module>
>>>>
>>>>     connection =
>>>> pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
>>>>
>>>>   File 
>>>>"/home/foo/src/pika-v0.9.5/pika/adapters/blocking_connection.py",
>>>> line 32, in __init__
>>>>
>>>>     BaseConnection.__init__(self, parameters, None,
>>>>reconnection_strategy)
>>>>
>>>>   File "/home/foo/src/pika-v0.9.5/pika/adapters/base_connection.py",
>>>>line
>>>> 50, in __init__
>>>>
>>>>     reconnection_strategy)
>>>>
>>>>   File "/home/foo/src/pika-v0.9.5/pika/connection.py", line 170, in
>>>>__init__
>>>>
>>>>     self._connect()
>>>>
>>>>   File "/home/foo/src/pika-v0.9.5/pika/connection.py", line 228, in
>>>>_connect
>>>>
>>>>     self.parameters.port or  spec.PORT)
>>>>
>>>>   File 
>>>>"/home/foo/src/pika-v0.9.5/pika/adapters/blocking_connection.py",
>>>> line 44, in _adapter_connect
>>>>
>>>>     self._handle_read()
>>>>
>>>>   File "/home/foo/src/pika-v0.9.5/pika/adapters/base_connection.py",
>>>>line
>>>> 162, in _handle_read
>>>>
>>>>     self._on_data_available(data)
>>>>
>>>>   File "/home/foo/src/pika-v0.9.5/pika/connection.py", line 597, in
>>>> _on_data_available
>>>>
>>>>     elif frame.channel_number > 0:
>>>>
>>>> AttributeError: 'ProtocolHeader' object has no attribute
>>>>'channel_number'
>>>>
>>>> Python version is 2.6.5. I'm running this on an ubuntu 10.4 system.
>>>>Pip
>>>>and
>>>> Pika were downloaded today per the web site instructions.
>>>>
>>>> I've searched everywhere and can't see the error referenced.
>>>>
>>>> Many thanks to anybody that can help me.
>>>>
>>>> Matt Pietrek.
>>>>
>>>>
>>>> _______________________________________________
>>>> rabbitmq-discuss mailing list
>>>> rabbitmq-discuss at lists.rabbitmq.com
>>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>>>
>>>>
>>
>>
>>




More information about the rabbitmq-discuss mailing list