Erlang/OTP Forums

Author Message

<  RabbitMQ mailing list  ~  Python client to RabbitMQ.....error?

Guest
Posted: Fri Sep 28, 2007 1:43 pm Reply with quote
Guest
Hi there,
Guest
Posted: Fri Sep 28, 2007 2:18 pm Reply with quote
Guest
Hi Lynton,

which version of the Qpid Python libraries did you use?

I'm cross-posting this to the qpid-dev list... so the Qpid python guys (not me) can help out,

Cheers,
Rob

On 28/09/2007, Lynton Grice <lynton.grice@netweaverguru.com (lynton.grice@netweaverguru.com)> wrote:
Quote:

Hi there,
alexis
Posted: Fri Sep 28, 2007 2:21 pm Reply with quote
User Joined: 06 Sep 2007 Posts: 80 Location: London
Lynton

Thanks for your email. I am really pleased you are impressed with RabbitMQ.

I am not sure how best to answer your question yet, but wanted to draw
your attention to a Python client that was posted to the list this
week by Dmitriy. That should work fine with RabbitMQ. Can you try
that client, if you have not, and let me know if things work. If you
have already tried it, please let us know.

alexis



On 9/28/07, Lynton Grice <lynton.grice@netweaverguru.com> wrote:
>
>
>
>
> Hi there,
>
>
>
> I hope someone can help me Wink..... I have been on the mail lists trying to
> find my problem but still no luck ;-( I am an SAP integration specialist and
> I play alot in Python, Erlang etc......and am VERY impressed so far with
> RabbitMQ.
>
>
>
> I have installed the RabbitMQ Server (1.2.0).....and have installed the QPID
> Python libs.....and I run on Windows XP....
>
>
>
> The server is up and running on the default port etc.....
>
>
>
> BUT I cannot get the Python code working properly or get the test runs
> going.......here is the code below that is dying:
>
>
>
> import qpid
>
> from qpid.client import Client
>
> from qpid.content import Content
>
>
>
> client = Client("127.0.0.1", 5672, spec=qpid.spec.load('amqp0-8.xml'))
> "spec is in the same directory....
>
> client.start({ 'LOGIN': 'guest', 'PASSWORD': 'guest'})
>
>
>
> The client.start method DIES.....and the user and password are
> correct....the error I get in Wing IDE is:
>
>
>
> Closed:
>
>
>
> Traceback (innermost last):
>
>
>
> File "D:\tmp\Rabbit\rabbit.py", line 1, in ?
>
> import qpid
>
> File "D:\tmp\Rabbit\rabbit.py", line 8, in ?
>
> client.start({ 'LOGIN': 'guest', 'PASSWORD': 'guest'}) File
> "D:\Python24\Lib\site-packages\qpid\client.py", line 83, in
> start
>
> self.channel(0).connection_open(self.vhost)
>
> File "D:\tmp\Rabbit\<string>", line 3, in connection_open File
> "D:\Python24\Lib\site-packages\qpid\peer.py", line 182, in
> invoke
>
> raise Closed(self.reason)
>
>
>
> If I debug the code it seems to go happily into the "client.py" code.....but
> when it calls "self.wait()" but then executes the following and raises
> "EOFError" because it seems to be closed or something
>
>
>
> self.started.wait()
>
> if self.closed:
>
> raise EOFError()
>
>
>
> I am probably doing something very stupid....just wanted to know if I need
> to START something on the server or install something like QPID? Or perhaps
> something else?
>
>
>
> Thanks for the help.....I would appreciate any sort of feedback on this.....
>
>
>
> Thanks again Wink
>
>
>
> Lynton
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss@lists.rabbitmq.com
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>


--
Alexis Richardson
+44 20 7617 7339 (UK)
+44 77 9865 2911 (cell)
+1 650 206 2517 (US)

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
View user's profile Send private message Yahoo Messenger
Guest
Posted: Fri Sep 28, 2007 2:54 pm Reply with quote
Guest
Hi Lynton,

Grice, Lynton wrote:
>
> =INFO REPORT==== 28-Sep-2007::16:04:06 ===
> accepted TCP connection on 0.0.0.0:5672 from 127.0.0.1:3259
>
> =INFO REPORT==== 28-Sep-2007::16:04:07 ===
> VHost access refused: no mapping for User <<"guest">>, VHost
> <<"127.0.0.1">>

Looks like this is what's causing it.
You can find access control docs at
http://www.rabbitmq.com/admin-guide.html#access-control.

But in this case I don't know why it tries to connect you to '127.0.0.1'
vhost - default vhost is '/' which includes mapping for user guest.

Maybe try this:


>> import qpid
>>
>> from qpid.client import Client
>>
>> from qpid.content import Content
>>
>>
>>
>> client = Client("127.0.0.1", 5672, spec=qpid.spec.load('amqp0-8.xml'))

Replace this line with this:
client = Client("127.0.0.1", 5672, spec=qpid.spec.load('amqp0-8.xml'),
vhost='/')

And see if it works.

Also, do you have the latest qpid python libs from subversion?

>>
>> client.start({ 'LOGIN': 'guest', 'PASSWORD': 'guest'})
>>



- Dmitriy

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
Guest
Posted: Fri Sep 28, 2007 6:52 pm Reply with quote
Guest
Hi there,

OK.....it works now....well almost......the problem was the VHOST....for
some reason the VHOST in the log file was 127.0.0.1....see below

=INFO REPORT==== 28-Sep-2007::16:04:07 === VHost access refused: no
> mapping for User <<"guest">>, VHost <<"127.0.0.1">>

So I changed the code to:

client = Client("127.0.0.1", 5672,
spec=qpid.spec.load('amqp0-8.xml'),vhost='/')

And now it works.....BUT now I have another problem.....it dies when trying
to receive the message it have just put onto the queue....

msg = q.get(timeout=1)

That throws the following exception:

KeyError: __eq__

Traceback (innermost last):

File "D:\tmp\Rabbit\rabbit.py", line 1, in ?
import qpid
File "D:\tmp\Rabbit\rabbit.py", line 22, in ?
msg = q.get(timeout=1)
File "D:\Python24\Lib\site-packages\qpid\queue.py", line 39, in get
if result == Queue.END:
File "D:\Python24\Lib\site-packages\qpid\message.py", line 70, in
__getattr__
env, key = self._slot(attr)
File "D:\Python24\Lib\site-packages\qpid\message.py", line 63, in _slot
field = self.method.fields.bypyname[attr]

Thanks for the help

Lynton



_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
Guest
Posted: Fri Sep 28, 2007 7:06 pm Reply with quote
Guest
Lynton,

Lynton Grice wrote:

> OK.....it works now....well almost......the problem was the VHOST....for
> some reason the VHOST in the log file was 127.0.0.1....see below
>
> =INFO REPORT==== 28-Sep-2007::16:04:07 === VHost access refused: no
>> mapping for User <<"guest">>, VHost <<"127.0.0.1">>
>
> So I changed the code to:
>
> client = Client("127.0.0.1", 5672,
> spec=qpid.spec.load('amqp0-8.xml'),vhost='/')

IMHO it is a bit strange for the vhost to default to the IP. You may
want to raise that with the qpid folks.

> And now it works.....BUT now I have another problem.....it dies when trying
> to receive the message it have just put onto the queue....
>
> msg = q.get(timeout=1)
>
> That throws the following exception:
>
> KeyError: __eq__
>
> Traceback (innermost last):
>
> File "D:\tmp\Rabbit\rabbit.py", line 1, in ?
> import qpid
> File "D:\tmp\Rabbit\rabbit.py", line 22, in ?
> msg = q.get(timeout=1)
> File "D:\Python24\Lib\site-packages\qpid\queue.py", line 39, in get
> if result == Queue.END:
> File "D:\Python24\Lib\site-packages\qpid\message.py", line 70, in
> __getattr__
> env, key = self._slot(attr)
> File "D:\Python24\Lib\site-packages\qpid\message.py", line 63, in _slot
> field = self.method.fields.bypyname[attr]

Is there anything unusual in the RabbitMQ logs? Check the LOG_BASE
directory - C:\Documents and Settings\User\rabbitmq\log if you are
using the default settings.

Also, which version of the amqp0-8.xml spec file are you using? The one
that comes with the qpid distribution is not the official version.
Replace it with the official version from
https://jira.amqp.org/confluence/download/attachments/720900/amqp0-8.xml.
I don't think that's the problem in this particular case though.


Matthias.

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
Guest
Posted: Fri Sep 28, 2007 7:15 pm Reply with quote
Guest
Lynton Grice wrote:
>
> msg = q.get(timeout=1)
>
> That throws the following exception:
>
> KeyError: __eq__
>
> Traceback (innermost last):
>
> File "D:\tmp\Rabbit\rabbit.py", line 1, in ?
> import qpid
> File "D:\tmp\Rabbit\rabbit.py", line 22, in ?
> msg = q.get(timeout=1)
> File "D:\Python24\Lib\site-packages\qpid\queue.py", line 39, in get
> if result == Queue.END:
> File "D:\Python24\Lib\site-packages\qpid\message.py", line 70, in
> __getattr__
> env, key = self._slot(attr)
> File "D:\Python24\Lib\site-packages\qpid\message.py", line 63, in _slot
> field = self.method.fields.bypyname[attr]
>

Could you please double check that you have the latest qpid python code
from subversion? I am at rev 580460 now. Based on this traceback, what
you have in d:\python24\lib\site-packages\qpid is not the latest: line
numbers don't match the code and bypyname is never mentioned in any of
the files. This can explain your vhost issue as well.

svn co http://svn.apache.org/repos/asf/incubator/qpid/trunk

http://cwiki.apache.org/qpid/source-repository.html

- Dmitriy

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist
Guest
Posted: Mon Oct 01, 2007 7:57 am Reply with quote
Guest
On 28/09/2007, Dmitriy Samovskiy <dmitriy.samovskiy@cohesiveft.com> wrote:
>
>
> Lynton Grice wrote:
> >
> > msg = q.get(timeout=1)
> >
> > That throws the following exception:
> >
> > KeyError: __eq__
> >
> > Traceback (innermost last):
> >
> > File "D:\tmp\Rabbit\rabbit.py", line 1, in ?
> > import qpid
> > File "D:\tmp\Rabbit\rabbit.py", line 22, in ?
> > msg = q.get(timeout=1)
> > File "D:\Python24\Lib\site-packages\qpid\queue.py", line 39, in get
> > if result == Queue.END:
> > File "D:\Python24\Lib\site-packages\qpid\message.py", line 70, in
> > __getattr__
> > env, key = self._slot(attr)
> > File "D:\Python24\Lib\site-packages\qpid\message.py", line 63, in _slot
> > field = self.method.fields.bypyname[attr]
> >
>
> Could you please double check that you have the latest qpid python code
> from subversion? I am at rev 580460 now. Based on this traceback, what
> you have in d:\python24\lib\site-packages\qpid is not the latest: line
> numbers don't match the code and bypyname is never mentioned in any of
> the files. This can explain your vhost issue as well.
>
> svn co http://svn.apache.org/repos/asf/incubator/qpid/trunk
>
> http://cwiki.apache.org/qpid/source-repository.html
>
> - Dmitriy
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss@lists.rabbitmq.com
> http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

It sounds like you are using quite an old version of the python
client. When the Qpid Java broker had vhosts and started testing with
vhosts I seem to recall that hostname as vhost default behaviour.

If you are looking for a published version then our M2 release should
be coming version soon.

hth
--
Martin Ritchie

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum