<font size="4">I have learned the&nbsp;<a href="http://www.rabbitmq.com/getstarted.html" class="selected" style="background-color: white; font-family: Verdana, sans-serif; line-height: 18px; text-align: left; color: rgb(68, 68, 68); font-weight: bold; ">Tutorials</a>&nbsp;on the rabbitmq website &nbsp;and &nbsp;all the cases work well.So &nbsp;I want to do more with it .&nbsp;</font><div><font size="4">I found that all the cases just publish a string to the queue ,can other object publish to queue? have a try . I did as follows:</font></div><div><br></div><div><b>send.py</b></div><div><br></div><div><div><font face="'courier new', monospace"># encoding=utf8</font></div><div><font face="'courier new', monospace">import pika</font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">class message:</font></div><div><font face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>id = 1</font></div><div><font face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>name = ""</font></div><div><font face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>body = ""</font></div><div><font face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>def __init__(self,name="message",body="hello world"):</font></div><div><font face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">                </span>self.name = name</font></div><div><font face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">                </span>self.body = body</font></div><div><font face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>def set_name(self,name):</font></div><div><font face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">                </span>self.name = name</font></div><div><font face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">        </span>def set_body(self,body):</font></div><div><font face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">                </span>self.body = body</font></div><div><font face="'courier new', monospace">msg = message()&nbsp;</font><b><font face="'courier new', monospace" style="border-style: initial; border-color: initial; "># I want to put this kind of object publish to the queue</font></b><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))</font></div><div><font face="'courier new', monospace">channel = connection.channel()</font></div><div><font face="'courier new', monospace">channel.queue_declare(queue='hello')</font></div><div><div><font face="'courier new', monospace">channel.basic_publish(exchange='',</font></div><div><font face="'courier new', monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; routing_key='hello',</font></div><div><font face="'courier new', monospace">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; body=msg)</font></div></div><div><font face="'courier new', monospace">print " [x] Sent 'Hello World!'"</font></div><div><font face="'courier new', monospace">connection.close()</font></div></div><div><br></div><div><font size="4">then <font face="verdana, sans-serif">i run this script , and i got this warning:</font></font></div><div><font size="4"><font face="verdana, sans-serif"><br></font></font></div><div><div><font size="2" face="'courier new', monospace">Traceback (most recent call last):</font></div><div><font size="2" face="'courier new', monospace">&nbsp; File "send.py", line 24, in &lt;module&gt;</font></div><div><font size="2" face="'courier new', monospace">&nbsp; &nbsp; body=msg)</font></div><div><font size="2" face="'courier new', monospace">&nbsp; File "build/bdist.linux-i686/egg/pika/adapters/blocking_connection.py", line 285, in basic_publish</font></div><div><font size="2" face="'courier new', monospace">&nbsp; File "build/bdist.linux-i686/egg/pika/adapters/blocking_connection.py", line 241, in send_method</font></div><div><font size="2" face="'courier new', monospace">&nbsp; File "build/bdist.linux-i686/egg/pika/connection.py", line 669, in _send_method</font></div><div><font size="2" face="'courier new', monospace"><i><u>AttributeError: message instance has no attribute '__len__'</u></i></font></div><div style="font-family: verdana, sans-serif; font-size: large; "><br></div></div><div><font size="4"><font face="verdana, sans-serif">the underline words is what I want to ask,how to &nbsp;deal with it , can I put an object to the queue because I hope to do like this ,do you have other method? Thanks!!</font></font></div><div><br></div>