python MQTT 出现TypeError: payload must be a string, bytearray, int, float or None.
原因, MQTT 发布信息,是不能发布 对象的,只能发布 字符串,整形,浮点型这样的
解决方法
self.__mqtt__.publish("computex/iot/5100/DataTransfer", json.dumps(send_msg))
// 将 json 的字典转换成字符串。
python MQTT 出现TypeError: payload must be a string, bytearray, int, float or None.的更多相关文章
- python import 错误 TypeError: 'module' object is not callable
python import 错误 TypeError: 'module' object is not callable 在这里,有 Person.py test.py; 在 test.py 里面 im ...
- TypeError: coercing to Unicode: need string or buffer, ChatRoom found
在用django框架中遇到一个错误,是模型编写中出的错误 TypeError: coercing to Unicode: need string or buffer, ChatRoom found 解 ...
- [转载] Python 列表(list)、字典(dict)、字符串(string)常用基本操作小结
创建列表 sample_list = ['a',1,('a','b')] Python 列表操作 sample_list = ['a','b',0,1,3] 得到列表中的某一个值 value_star ...
- Python 列表(list)、字典(dict)、字符串(string)常用基本操作小结
创建列表 sample_list = ['a',1,('a','b')] Python 列表操作 sample_list = ['a','b',0,1,3] 得到列表中的某一个值 value_star ...
- TypeError: sequence item 1: expected str instance, int found
Error Msg Traceback (most recent call last): File "E:/code/adva_code/my_orm.py", line 108, ...
- TypeError: sequence item 0: expected string, Tag found
原始代码: soup = BeautifulSoup(result, 'html.parser') content_list = soup.find_all('p', attrs={"cla ...
- java和python中的string和int数据类型的转换
未经允许,禁止转载!!! 在平时写代码的时候经常会用到string和int数据类型的转换 由于java和python在string和int数据类型转换的时候是不一样的 下面总结了java和python ...
- Python学习(四)数据结构 —— int float
Python 数字类型 int float 数字常量 int: 一般的整数, long: 长整型,2.x版本需在数字后加 “L” 或 “l” ,表示长整型 如 100000000L: python ...
- python django中使用sqlite3数据库 存储二进制数据ByteArray
在python中使用sqlite3数据库存储二进制流数据ByteArray,在django使用sqlite3数据库时,有时候也要注意最好使用二进制流ByteArray插入字符串. 使用ByteArra ...
随机推荐
- Android 关于导航栏(虚拟按键)遮挡PopupWindow底部布局的问题
我们自定义popupWindow的时候,一般会设置这些参数 setContentView(contentView); //设置高度为屏幕高度 setWidth(UIUtils.getScreenHei ...
- 10个优秀的jQuery Mobile主题
原文链接:http://caibaojian.com/10-best-free-jquery-mobile-theme.html jQuery Mobile 是一个伟大的框架,而每个伟大的产品都需要一 ...
- mysql中Table is read only错误解决方法
今天再我把数据库data 拷贝到linux 下运行程序 ”mysql中Table is read only的解决“ 出现这样的问题,查询资料. linux下执行如下命令即可 #mysqladmin - ...
- GANS 资料
https://blog.csdn.net/a312863063/article/details/83512870 目 录第一章 初步了解GANs 3 1. 生成模型与判别模型. 3 2. 对抗网络思 ...
- Java 8 – How to sort a Map
Java 8 – How to sort a Map 1. Quick ExplanationMap result = map.entrySet().stream() .sorted(Map.Entr ...
- js 万恶之源 是否滚动到底部?
let scrollHandle = (el) => { // 如果已经滚到底部了 if (el.scrollHeight - el.scrollTop === el.clientHeight) ...
- 使用 Swagger 文档化和定义 RESTful API
大部分 Web 应用程序都支持 RESTful API,但不同于 SOAP API——REST API 依赖于 HTTP 方法,缺少与 Web 服务描述语言(Web Services Descript ...
- IOS团队开发之——CocoaPods 第三方库管理工具
使用前需要下载ruby 的gem 命令镜像,mac 下自带有.但一般不用,直接访问国外网站有限制. 下面安装 http://ruby.taobao.org/ http://blog.devtang.c ...
- x64共享库中的位置无关代码(PIC)
原作者:Eli Bendersky http://eli.thegreenplace.net/2011/11/11/position-independent-code-pic-in-shared-li ...
- [svc]ssh+gg二步认证
1,安装依赖 yum install python-pip -y pip install docutils yum install gcc python-devel subversion pam pa ...