网上很多写法都是 type='fanout' 这样的。(这里是基于python=3.6版本, pika=0.13.0 版本)

credentials = pika.PlainCredentials('guest', 'guest')
connection = pika.BlockingConnection(pika.ConnectionParameters('127.0.0.1',5672,'/',credentials))
channel = connection.channel()
# 定义交换机,exchange表示交换机名称,type表示类型
channel.exchange_declare(exchange='logs_fanout', type='fanout')

抛出异常

channel.exchange_declare(exchange='logs_fanout', type='fanout')
TypeError: exchange_declare() got an unexpected keyword argument 'type'

应该把:type='fanout' 改成 change_type='fanout'

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

Python pika, TypeError: exchange_declare() got an unexpected keyword argument 'type' 问题修复的更多相关文章

  1. TypeError: exchange_declare() got an unexpected keyword argument 'type'

    在设置消息广播时:以下代码会报错channel.exchange_declare(exchange='direct_logs', type='direct')TypeError: exchange_d ...

  2. TypeError: parse() got an unexpected keyword argument 'transport_encoding'

    错误: TypeError: parse() got an unexpected keyword argument 'transport_encoding'You are using pip vers ...

  3. TypeError: __init__() got an unexpected keyword argument 't_command'

    python  .\manage.py migrate 报错如下 λ python .\manage.py migrateTraceback (most recent call last): File ...

  4. TypeError: pivot_table() got an unexpected keyword argument 'rows'

    利用Python进行数据分析>第二章,处理MovieLens 1M数据集,有句代码总是报错: mean_rating = data.pivot_table('rating', rows='tit ...

  5. TypeError: __init__() got an unexpected keyword argument 'serialized_options'

    问题描述: TypeError: __init__() got an unexpected keyword argument 'serialized_options' File "objec ...

  6. 记录 TypeError: render() got an unexpected keyword argument 'renderer' 错误

    在网上看到MXShop这个项目,适合Python, Django + drf 进阶的,其中遇到 TypeError: render() got an unexpected keyword argume ...

  7. 关于Jupyter Notebook无法自动补全(Autocompletion),报错TypeError: __init__() got an unexpected keyword argument 'column' 的解决方案

    关于Jupyter Notebook无法自动补全(Autocompletion),报错TypeError: __init__() got an unexpected keyword argument ...

  8. TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'

    错误: TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations' 参照https://blog.c ...

  9. TypeError: to_categorical() got an unexpected keyword argument 'nb_classes'

    在学习莫烦教程中keras教程时,报错:TypeError: to_categorical() got an unexpected keyword argument 'nb_classes',代码如下 ...

随机推荐

  1. ThinkPHP中的find和select的区别

    ThinkPHP作为PHP中应用广泛又好用的框架,能比较快速的开发MVC架构的管理系统,获得了大量的应用.但是在ThinkPHP中select()和find()方法有什么区别呢? 事实上find()返 ...

  2. Python函数-dir()

    dir([object])函数 作用: 没有参数,返回当前本地范围内的名称列表.使用参数,试图返回该对象的有效属性的列表. 说明: 默认dir()机制表现出有不同类型的对象,因为它试图产生最相关的,而 ...

  3. ConcurrentHashMap的扩容机制(jdk1.8)

    ConcurrentHashMap相关的文章网上有很多,而关于ConcurrentHashMap扩容机制是很关键的点,尤其是在并发的情况下实现数组的扩容的问题经常会碰到,看到这篇写的具有代表性,详细讲 ...

  4. 第9章 DOM对象,控制HTML元素

    学习地址:http://www.imooc.com/learn/10

  5. flask之instance_path实例路径

    Flask 0.8 introduces instance folders. Flask for a long time made it possible to refer to paths rela ...

  6. redis4.0.1集群安装部署

    安装环境 序号 项目 值 1 OS版本 Red Hat Enterprise Linux Server release 7.1 (Maipo) 2 内核版本 3.10.0-229.el7.x86_64 ...

  7. 有关UCOS_II在LPC1768上的应用

    https://www.cnblogs.com/chungshu/archive/2012/12/14/2818380.html

  8. LINUX必须记住的指令

    写在前面: 1,<你一定要知道的关于Linux文件目录操作的12个常用命令>是楼主收集的关于Linux文件目录操作最常用的命令,包括文件或目录的新建.拷贝.移动.删除.查看等,是开发人员操 ...

  9. declare handler 声明异常处理的语法

    声明异常处理的语法 DECLARE {EXIT | CONTINUE} HANDLER FOR {error-number | SQLSTATE error-string | condition} S ...

  10. SQL修改日期时间型数据中的年月日

    以下语句为更改 tevent表中的eventtime字段为2011-7-16当eventtime为2012-02-29时 update tevent set  eventtime='2011-7-16 ...