TypeError: unhashable type when publishing using rabbitmq

ساخت وبلاگ

Vote count: 0

I am trying to pass a python dictionary to a rabbitmq queue via pika, this is probably a python problem and not rabbitmq itself. I am getting an error as stated above and here is my code:

def PingAddScan(deviceID, ipAddress, deviceHistory, item, date, apiURL, browserConId): if PingDevice(deviceID, ipAddress): BasicScan(ipAddress, deviceID, item, apiURL) deviceHistory[deviceID] = date # After the basic scan we are going to need to push a message back to the user to say # that the pathfinder has successfully found the device, and it should prompt the user # what he wants to scan print browserConId + " : " + deviceID channelOutbound.queue_declare(queue='outboundMessaging', durable=True) message = {"browserConnectionID": browserConId, "data": "FOUND", "deviceID": deviceID} print str(message) channelOutbound.basic_publish(exchange='messaging', routing_key='outbound', body=message)

and here is the full stack trace:

 Traceback (most recent call last): File "pathfinderAllocator.py", line 454, in <module> channel.start_consuming() File "/usr/local/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 1755, in start_consuming self.connection.process_data_events(time_limit=None) File "/usr/local/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 715, in process_data_events self._dispatch_channel_events() File "/usr/local/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 518, in _dispatch_channel_events impl_channel._get_cookie()._dispatch_events() File "/usr/local/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 1384, in _dispatch_events evt.body) File "pathfinderAllocator.py", line 439, in callback PingAddScan(deviceID, ipAddress, deviceHistory, new_device, date, data, browser_connectionid) File "pathfinderAllocator.py", line 337, in PingAddScan body=message) File "/usr/local/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 2052, in basic_publish mandatory, immediate) File "/usr/local/lib/python2.7/site-packages/pika/adapters/blocking_connection.py", line 2138, in publish immediate=immediate) File "/usr/local/lib/python2.7/site-packages/pika/channel.py", line 421, in basic_publish (properties, body)) File "/usr/local/lib/python2.7/site-packages/pika/channel.py", line 1324, in _send_method self.connection._send_method(self.channel_number, method, content) File "/usr/local/lib/python2.7/site-packages/pika/connection.py", line 2137, in _send_method self._send_message(channel_number, method, content) File "/usr/local/lib/python2.7/site-packages/pika/connection.py", line 2164, in _send_message content[1][start:end]).marshal())
TypeError: unhashable type
asked 46 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 228 تاريخ : جمعه 4 تير 1395 ساعت: 19:12