【发布时间】:2013-08-20 16:40:47
【问题描述】:
首先我想说的是,我不仅是 python 新手,而且是一般编程新手。考虑到这一点,这是我的问题。我正在尝试将一些数据发送到我的 Rabbitmq 服务器。下面是我的 Python 代码。 json_data 只是一个保存一些 json 格式数据的变量。
with Connection("amqp://username:password@test_server.local:5672/#/") as conn:
channel = conn.channel()
producer = Producer(channel, exchange = "test_exchange", serializer="json")
producer.publish(json_data)
print "Message sent"
这会产生以下错误:
Traceback (most recent call last):
File "test.py", line 43, in <module>
producer = Producer(channel, exchange = "test_exchange", serializer="json")
File "/Library/Python/2.7/site-packages/kombu/messaging.py", line 83, in __init__
self.revive(self._channel)
File "/Library/Python/2.7/site-packages/kombu/messaging.py", line 210, in revive
self.exchange = self.exchange(channel)
TypeError: 'str' object is not callable
任何帮助将不胜感激。谢谢。
【问题讨论】:
标签: python rabbitmq amqp kombu