错误宝典

错误信息1:SyntaxError:invalid syntax--无效语法

解决办法:变量名不能使用关键字如下图:

错误信息2:TypeError:'str' object is not callable--字符串对象不是可以输出的

解决办法:不建议使用Python内置方法为变量名、print这个函数的名字给覆盖、使用print的时候找到的是自己定义的值

错误信息3:TypeError: Can't convert 'int' object to str implicitly--类型错误无法隐式将“int”对象转换为str(环境是Python3.5版本)

解决办法:用int转下str字符串类型

错误信息4:TypeError: must be str, not int--类型错误必须是字符串不能是整型(Python3.6版本)

 解决办法:用int转下str字符串类型

错误信息5:TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'--类型错误int()参数必须是字符串、类似对象的字节或数字,而不是'nonet'

解决办法:

错误信息6:TypeError: %d format: a number is required, not str--类型错误、格式需要数字而不是字符串

解决办法:字符串前面加int

错误信息6:TypeError: not enough arguments for format string--typeerror:格式字符串的参数不足

解决办法:增加缺少占位的参数。

错误信息7:TypeError: not all arguments converted during string formatting--typeerror:不是所有在字符串格式化期间转换的参数

解决办法:参数过多了要去掉。

错误信息8:'tuple' object doesn't support item deletion--“tuple”对象不支持项删除

错误信息9:RuntimeError: dictionary changed size during iteration--运行时错误:字典在迭代期间更改了大小

错误信息10:RuntimeError: Set changed size during iteration--运行时错误:在迭代期间设置更改的大小。

错误信息11:IndentationError: expected an indented block--缩进错误:需要缩进的块

错误信息12:TypeError: write() argument must be str, not int--typeerror:write()参数必须是str,而不是int

错误信息13:IndentationError: unexpected indent--缩进错误:意外缩进。

错误信息14:TypeError: list indices must be integers or slices, not str--列表的索引必须是整数或切片、而不是str

错误信息15:NameError: name 's' is not defined--名称错误:名称不是定义。

错误信息16:SyntaxError: keyword argument repeated--语法错误:关键字参数重复

错误信息17:TypeError: 'a1' is an invalid keyword argument for this function--类型错误:'a1'是此函数的无效关键字参数

错误信息18:TypeError: 'int' object is not callable--类型错误:int对象不可调用。

错误信息19:TypeError: 'int' object is not callable--类型错误、int对象不可调用

错误信息20:IndentationError: unexpected indent--缩进错误、意外缩进

错误信息21:UnboundLocalError: local variable 'name' referenced before assignment--取消绑定本地错误、赋值前引用的局部变量"name"

错误信息22:SyntaxError: no binding for nonlocal 'a' found--语法错误、未找到非本地a的绑定

解决办法:nonlocal不能放在global下面

错误信息23:TypeError: <lambda>() missing 1 required positional argument: 'i'--类型错误、lambda缺少一个必须的位置参数

解决办法:em里面增加值

错误信息24:TypeError: list indices must be integers or slices, not str--类型错误:列表索引必须是整数或切片,而不是str

错误信息25:ValueError: too many values to unpack (expected 2)--值错误:要解包的值太多(应为2)

错误信息26:TypeError: 'type' object is not subscriptable--typeerror:“type”对象不可订阅

错误信息27:TypeError: run_time() missing 1 required positional argument: 'f'--typeerror:run_time()缺少1个必需的位置参数:“f”

错误信息28:TypeError: '<' not supported between instances of 'dict' and 'dict'--类型错误:“dict”和“dict”的实例之间不支持“<”

错误信息29:TypeError: 'generator' object is not subscriptable--typeerror:“generator”对象不可订阅

错误信息30:TypeError: unsupported operand type(s) for +: 'function' and 'str'--typeerror:不支持+的操作数类型:“function”和“str”

错误信息31:RecursionError: maximum recursion depth exceeded while calling a Python object--递归错误:调用Python对象时,最大递归深度超过了

  [Previous line repeated 993 more times]--[上一行重复993次]

错误信息32:SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated UXXXXXXXX escape--syntaxerror:(unicode错误)“unicode escape”编解码器无法解码位置2-3中的字节:截断的uxxx escape

错误信息33:ModuleNotFoundError: No module named 'lib'--moduleNotFounderror:没有名为“lib”的模块、循环导入报错

错误信息34:AttributeError: module 'core.src' has no attribute 'login_dic'--属性错误:attributeerror:模块'core.src'没有'login dic'属性

错误信息35:ValueError: not enough values to unpack (expected 2, got 1)--值错误:没有足够的值来解包(应为2,得到1)

错误信息36:

You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard page generated by the handler for this status code.--您看到这个错误是因为您的Django设置文件中有DEBUG=True。将其更改为False,Django将显示处理程序为此状态代码生成的标准页。

解决:selenium.common.exceptions.WebDriverException: Message: 'chromedriver' execu

解决办法:
安装与浏览器版本匹配的webdriver
1、打开谷歌浏览器, 在地址栏输入 chrome://version/ 查看版本信息:

2、选择合适版本的驱动下载,
下载地址:http://chromedriver.storage.googleapis.com/index.html

3.解压下载的驱动放到指定目录,代码调用时指定该目录即可。
解压后的目录:

将chromedriver.exe 放入安装的selenium库下


运行的程序如下:

from selenium import webdriver
chrome_driver=r"D:PythonAnacondaLibsite-packagesseleniumwebdriverchromechromedriver.exe"
driver=webdriver.Chrome(executable_path=chrome_driver)
1
2
3

运行成功!!!!!!

原文地址:https://www.cnblogs.com/zhang-da/p/11552391.html