[rabbitmq-discuss] Python / QPID to RabbitMQ....no MLLIB??

Lynton Grice lynton.grice at netweaverguru.com
Mon Oct 1 09:06:29 BST 2007


Hi there,

Here is the code I am using.....still getting the " AttributeError:
__eq__"......not sure what is going wrong......I will try the other code you
recommended just now and see what happens....

import sys

sys.path = sys.path + ['D:\Python24\Lib\site-packages\python-qpid']

import qpid
from qpid.client import Client
from qpid.content import Content

client = Client("localhost", 5672, spec=qpid.spec.load('amqp0-8.xml'))
client.start({ 'LOGIN': 'guest', 'PASSWORD': 'guest'}) 

ch = client.channel(1) 
ch.channel_open() 
ch.queue_declare(queue="testq", exclusive=True) 
ch.queue_bind(queue="testq", exchange="amq.direct", routing_key="test") 

print 'Sending message "ping"...  ', 
content=Content("ping"),exchange='amq.direct') 
ch.basic_publish(routing_key="test",
content=Content("ping"),exchange='amq.direct') 
print 'done' 

print 'Receiving message' 
t = ch.basic_consume(queue="testq", no_ack=True) 
q = client.queue(t.consumer_tag) 
msg = q.get(timeout=1) 
print 'Got message:', msg.content.body

-----Original Message-----
From: Dmitriy Samovskiy [mailto:dmitriy.samovskiy at cohesiveft.com] 
Sent: 30 September 2007 05:17 PM
To: Lynton Grice
Cc: rabbitmq-discuss at lists.rabbitmq.com
Subject: Re: [rabbitmq-discuss] Python / QPID to RabbitMQ....no MLLIB??

Hi Lynton,

Lynton Grice wrote:
> 
> print 'Receiving message'
> t = ch.basic_consume(queue="testq", no_ack=True)
> q = client.queue(t.consumer_tag)
> msg = q.get(timeout=1)
> print 'Got message:', msg.content.body
> 
> 
> AttributeError: __eq__
> 
> Traceback (innermost last):
> File "D:\tmp\Rabbit\rabbit.py", line 1, in ?
>   import sys
> File "D:\tmp\Rabbit\rabbit.py", line 27, in ?
>   msg = q.get(timeout=1)
> File "D:\Python24\Lib\site-packages\qpid\queue.py", line 46, in get
>   if result == Queue.END:
> File "D:\Python24\Lib\site-packages\qpid\message.py", line 61, in 
> __getattr__
>   raise AttributeError(attr)

I can't reproduce your problem. Could you post your entire script?

Alternatively, could you try running disttailf.py that I posted to the 
list earlier, as Alexis once suggested? You would need to adjust 
QPID_SVN_PATH to match location of qpid python libs on your system. 
Start consumer in one window as "disttailf.py -c" and then start a 
producer in another window as "disttailf.py d:\tmp\rabbit\rabbit.py" and 
let us know what you see.

- Dmitriy





More information about the rabbitmq-discuss mailing list