channel.exchange_declare(exchange='logs',
type='fanout')

报错:

Traceback (most recent call last):
  File "D:/fanout_server.py", line 12, in <module>
    type='fanout')
TypeError: exchange_declare() got an unexpected keyword argument 'type'

 

原因这里的type参数必须指定为exchange_type才行

channel.exchange_declare(exchange='logs',
exchange_type='fanout')

改完之后运行正常,但奇怪的是有的人用type指定就没问题,搞不懂