当前位置:   article > 正文

在学习Python时遇到的一些项目bug_typeerror: _couldnotimportpyscreeze() got an unexp

typeerror: _couldnotimportpyscreeze() got an unexpected keyword argument 'co

启动线程,开启任务时:

1.出现错误TypeError: __init__() got an unexpected keyword argument 'arg'

ok,python没有能解析出来这个参数,好吧少写了个s,加上就没啥问题了

2.出现错误TypeError: get() missing 1 required positional argument: 'device_id'

        device_id的值没传好,修改scheduler.add_job中的args=('2'),设置传入的参数值为2

3.AttributeError: module 'xxx' has no attribute 'xxx'

        模块没导好,重新删除该模块再导入一遍

4.Method must have a first parameter, usually called 'self'

        意思是说你的方法应该有self的参数,可能是因为我把函数和类改来改去,不知道为什么python要有这个东西,还在搞懂。

5.TypeError: Object of type TypeError is not JSON serializable

        数据类型错误的问题,我是用python操作es数据库创建文档时的操作错误,或者是你请求什么返回的数据有误

6.TypeError: 'module' object is not callable

        包导错了,再导入一遍。

7.sqlite3.OperationalError: no such table: xxx

        sqlite连接的数据库有问题,我使用的是相对位置,得使用绝对位置。sqlite3.connect(绝对位置)

8.AttributeError: 'NoneType' object has no attribute 'keys'

        是从sqlite查询得出来的数据是空,没有keys()属性,所以要么是你数据库的位置不对,要么是你数据库创建的有问题,导致得出来的结果是空,出现这个错误。

9.json.dumps中文乱码

json.dumps 序列化时候默认使用的ascii编码,想输出真正的中文需要指定ensure_ascii=False;更深入分析,是因为JSON object 不是单纯的unicode实现,而是包含了混合的unicode编码以及已经用utf-8编码之后的字符串。

json.dumps(res,ensure_ascii=False)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/286523
推荐阅读
相关标签
  

闽ICP备14008679号