接口开发常见报错

AttributeError: 'NoneType' object has no attribute 'strip'

本地gitlab项目没有放置data文件夹,文件夹里面没有对应的模型,模型的名字或者路径错误

Useless suppression of %s' 或者Useless suppression of 'import-error' (useless-suppression)

代表该段代码没生效

TypeError: not all arguments converted during string formatting

logging.error(a, errs)。这样写是错误的,正确是只有一个值logging.error(errs)

Formatting a regular string which could be a f-string (consider-using-f-string)

字符串的格式化尽量用f,如:print(f"result is {result}")

Variable name "xxxx" doesn't conform to '([a-z0-9_]+)$' pattern (invalid-name)

变量的名字需要小写

MySQLdb._exceptions.ProgrammingError: (1146, "Table 'xxx' doesn't exist")

代表该数据表已经删除,或者表的结构变化

TypeError: Attempted to convert a callback into a command twice.

这样写是错误的,会陷入死循环
def train():
 train()

Loading faiss with AVX2 support.

不是报错,而是因为没有需要执行的命令

TypeError: None is not a callable object

保证 a,b,c = k,k必须是一个非空的值

(wildcard-import)

import时使用了* ,建议只import 明确的库


 ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

解决方法不能直接判断numpy是否为空,可以换成判断类型

TypeError: cannot unpack non-iterable NoneType object

加载模型的时候要排除模型为空的情况。

NotImplementedError

子类没有实现父类要求一定要实现的接口,

要注意子类的某个函数的缩进是否正确。

Empty class docstring (empty-docstring)

不能有空的备注

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

贝叶斯巴达

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值