Python Bug
文章平均质量分 84
Python Bug相关内容
ninghes
这个作者很懒,什么都没留下…
展开
-
解决:selenium.common.exceptions.JavascriptException: Message: javascript error: $ is not defined
背景在使用之前的代码时,报错:Traceback (most recent call last):File “xxx”, line xx, indriver.execute_script(“$(arguments[0]).click()”,dbt)File “D:\develop\python\Python3\Python37\lib\site-packages\selenium\webdriveremote\webdriver.py”, line 405, in ......原创 2024-06-06 00:00:00 · 1496 阅读 · 1 评论 -
解决Selenium NameError: name ‘By’ is not defined
在使用Selenium进行Web自动化测试时,遇到了一个常见的错误:NameError: name 'By' is not defined。这个错误表明我们的代码中没有正确地导入By类,导致无法识别By这个名称。错误原因未导入By类:在使用Selenium时,我们需要从selenium.webdriver.common.by模块中导入By类,以便使用其提供的定位策略(如By.ID, By.XPATH等)。拼写错误或大小写问题:在Python中,大小写敏感,所以必须确保By的拼写完全正确。原创 2024-05-22 20:54:44 · 1061 阅读 · 0 评论 -
解决:ModuleNotFoundError: No module named ‘torchvision’
背景在使用之前的代码时,报错: Traceback (most recent call last): File "xxx", line xx, in import torchvision ModuleNotFoundError: No module named 'torchvision'翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在导入torchvision......原创 2024-02-01 00:00:00 · 10408 阅读 · 13 评论 -
解决:ModuleNotFoundError: No module named ‘tiktoken’
背景在使用之前的代码时,报错: Traceback (most recent call last): File "xxx", line xx, in import tiktoken ModuleNotFoundError: No module named 'tiktoken'翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在导入tiktokenModuleNotFoundError:没有名为“tiktoken”的模块```.....原创 2024-01-31 18:02:44 · 2197 阅读 · 0 评论 -
解决:NameError: name ‘x’ is not defined
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in print(Employee) # 👈️ 拼写错误的变量名...NameError: name 'x' is not defined翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在中print(员工)#👈️ 拼写错误的变量名...NameError:未定义名称“x”.....原创 2024-01-31 17:33:13 · 2841 阅读 · 0 评论 -
解决:AttributeError: ‘str’ object has no attribute ‘capabilities’
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in driver = webdriver.Chrome() File \“xxx/webdriver.py\”, line 73, in __init__ super().__init__() File \“xxx/webdriver.py\”, line 104, in __init__ ......原创 2024-01-30 18:00:00 · 6971 阅读 · 2 评论 -
解决:ModuleNotFoundError: No module named ‘selenium’
背景在使用之前的代码时,报错: Traceback (most recent call last): File "xxx", line xx, in import selenium ModuleNotFoundError: No module named 'selenium'翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在导入seleniumModuleNotFoundError:没有名为“selenium”的模块```原因...原创 2024-01-30 11:23:52 · 5336 阅读 · 0 评论 -
解决:‘chromedriver’ executable needs to be in PATH
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in driver = webdriver.Chrome()'chromedriver’ executable needs to be in PATH翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在中driver=网络驱动程序。色度()“chromedriver”可执行文件需要在......原创 2024-01-26 19:54:46 · 2790 阅读 · 1 评论 -
解决:selenium.common.exceptions.WebDriverException:Message:Can not connect to the Service chromedriver
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in driver = webdriver.Chrome() File \“xxx/webdriver.py\”, line 73, in init self.service.start() File \“xxx/service.py\”, line 104, in start.......原创 2024-01-26 17:31:10 · 2492 阅读 · 0 评论 -
解决:ModuleNotFoundError: No module named ‘dbutils’
背景在使用之前的代码时,报错: Traceback (most recent call last): File "xxx", line xx, in import dbutils ModuleNotFoundError: No module named 'dbutils'翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在导入dbutilsModuleNotFoundError:没有名为“dbutils”的模块```原因 ......原创 2024-01-13 00:00:00 · 2287 阅读 · 0 评论 -
解决:ModuleNotFoundError: No module named ‘dbutils’
背景在使用之前的代码时,报错: Traceback (most recent call last): File "xxx", line xx, in import dbutils ModuleNotFoundError: No module named 'dbutils'翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在导入dbutilsModuleNotFoundError:没有名为“dbutils”的模块```原因 ......原创 2024-01-12 12:45:00 · 1829 阅读 · 0 评论 -
解决:ModuleNotFoundError: No module named ‘pymysql’
背景在使用之前的代码时,报错: Traceback (most recent call last): File "xxx", line xx, in import pymysql ModuleNotFoundError: No module named 'pymysql'翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在导入pymysqlModuleNotFoundError:没有名为“pymysql”的模块```原因 ......原创 2024-01-12 01:00:00 · 7966 阅读 · 2 评论 -
解决:TypeError: ‘dict_keys’ object does not support indexing
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in lst[0] = 2TypeError: 'dict_keys' object does not support indexing翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在中lst[0]=2TypeError:“dict_keys”对象不支持索引```原因经过查阅资料...原创 2024-01-11 18:45:00 · 600 阅读 · 0 评论 -
解决:TypeError: ‘set’ object does not support indexing
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in name_list1[0] = 2TypeError: 'set' object does not support indexing翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在中name_list1[0]=2TypeError:“set”对象不支持索引```原因......原创 2024-01-11 12:08:38 · 932 阅读 · 0 评论 -
解决:TypeError: ‘tuple’ object does not support item assignment
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in b[0] = 2TypeError: 'tuple' object does not support item assignment翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在中b[0]=2TypeError:“tuple”对象不支持项分配```原因经过查阅资料,发现 ...原创 2024-01-06 21:04:59 · 994 阅读 · 0 评论 -
解决:ModuleNotFoundError: No module named ‘bs4’
背景在使用之前的代码时,报错: Traceback (most recent call last): File "xxx", line xx, in import bs4 ModuleNotFoundError: No module named 'bs4'翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在导入bs4ModuleNotFoundError:没有名为“bs4”的模块```原因经过查阅资料,发现是这个错误通常是由于...原创 2024-01-06 00:30:00 · 4435 阅读 · 1 评论 -
解决:ERROR: Failed building wheel for xxx
背景在使用之前的代码构建环境时,报错:ERROR: Failed building wheel for xxx翻译:```错误:为xxx构建轮子失败```原因经过查阅资料,发现是这个错误产生的原因是由于没有安装python-dev导致的,需要安装python-dev,否则就会出现这样的错误。原创 2024-01-05 18:30:00 · 2399 阅读 · 2 评论 -
解决:ModuleNotFoundError: No module named ‘zhon’
背景在使用之前的代码时,报错: Traceback (most recent call last): File "xxx", line xx, in import zhon ModuleNotFoundError: No module named 'zhon'翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在导入zhonModuleNotFoundError:没有名为“zhon”的模块```原因经过查阅资料,发现......原创 2024-01-05 12:45:25 · 1585 阅读 · 0 评论 -
解决:ValueError:Timeout value connect was Timeout(connect=2.0,read=2.0,total=None),but it must be an
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in req = requests.get(url, headers=headers, proxies=proxies, timeout=(3,7))ValueError: Timeout value connect was Timeout(connect=2.0, read=2.0, total=None), but it ...原创 2024-01-03 19:30:49 · 1043 阅读 · 0 评论 -
解决:TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in req = requests.get(url, headers=headers, proxies=proxies)TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败翻译:```追溯(最近一次通话):文件“xxx”,第xx行 ... ...原创 2024-01-03 23:45:00 · 5138 阅读 · 0 评论 -
解决:PermissionError: [Errno 13] Permission denied: ‘xxx’
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in with open(file_path, 'r') as f:PermissionError: [Errno 13] Permission denied: 'xxx' 翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在中open(file_path,'r')为f:......原创 2024-01-02 20:34:22 · 3000 阅读 · 0 评论 -
解决:ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in if data_1==data_2:ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在原创 2024-01-02 01:00:00 · 2766 阅读 · 2 评论 -
解决:OSError: cannot write mode RGBA as JPEG
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in captcha.save('code.png')OSError: cannot write mode RGBA as JPEG翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在中captcha.save('code.png')O错误:无法将模式RGBA写入JPEG```原因...原创 2023-12-21 13:00:00 · 1555 阅读 · 0 评论 -
解决:AttributeError: module ‘scipy.misc’ has no attribute ‘imresize’
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in misc.imresize(cropped_temp, (image_size, image_size), interp='bilinear')AttributeError: module 'scipy.misc' has no attribute 'imresize'翻译:```追溯(最近一次通话):......原创 2023-12-21 00:06:17 · 1177 阅读 · 0 评论 -
解决:AttributeError: module ‘scipy.misc’ has no attribute ‘imread’
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in misc.imread(input_path)AttributeError: module 'scipy.misc' has no attribute 'imread'翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在中杂项imread(输入路径)AttributeError......原创 2023-12-18 13:00:00 · 2529 阅读 · 0 评论 -
解决:AttributeError: module ‘scipy.misc’ has no attribute ‘imsave’
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in misc.imsave(output_path, scaled_temp)AttributeError: module 'scipy.misc' has no attribute 'imsave'翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在中misc.imsave ... ...原创 2023-12-18 00:00:00 · 1885 阅读 · 0 评论 -
解决:TypeError: write() argument must be str, not tuple
背景在使用之前的代码时,报错:Traceback (most recent call last): File "E:/Test/test.py", line 14, in file.write(lines)TypeError: write() argument must be str, not tuple翻译:```追溯(最近一次通话):文件“E:/Test/Test.py”,第14行,在中file.write(lines)... ...原创 2023-12-16 22:28:42 · 2024 阅读 · 0 评论 -
解决:AttributeError: ‘dict’ object has no attribute ‘has_key’
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in print(dict.has_key("name"))AttributeError: 'dict' object has no attribute 'has_key翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在中print(dict.has_key("name"))... ...原创 2023-12-16 00:15:00 · 2683 阅读 · 0 评论 -
解决:InsecureRequestWarning:Unverified HTTPS request is being made to host ‘xx.cn’. Adding ......
背景在使用之前的代码时,报错:D:/Anaconda_soft/envs/pytorch/lib/site-packages/urllib3/connectionpool.py:1043: InsecureRequestWarning: Unverified HTTPS request is being made to host 'www.dytt89.com'. Adding certificate verification is strongly advised. See: ......原创 2023-12-15 00:15:00 · 2144 阅读 · 0 评论 -
解决:requests.exceptions.ProxyError:HTTPSConnectionPool(host=‘xxx.com’,port=443):Max retries exceeded
背景在使用之前的代码时,报错:requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.xxxx.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', timeout('_ssl.c:1108: The handshake operation timed out')))... ...原创 2023-12-14 12:45:00 · 6599 阅读 · 1 评论 -
解决:ImportError: cannot import name ‘PyKeyboard’ from ‘pykeyboard’
背景在使用之前的代码时,报错:Traceback (most recent call last): File "xxx", line xx, in from pykeyboard import PyKeyboard ImportError: cannot import name 'PyKeyboard' from 'pykeyboard' (D:/python/xxx/__init__.py)翻译:```追溯(最近一次通话):文件“xxx”,第xx行 ......原创 2023-12-14 00:30:00 · 1596 阅读 · 0 评论 -
解决:ModuleNotFoundError: No module named ‘windows’
背景在使用之前的代码时,报错:Traceback (most recent call last): File "E:/Test/test.py", line 14, in from pymouse import PyMouse, PyMouseEventModuleNotFoundError: No module named 'windows'翻译:```追溯(最近一次通话):文件“E:/Test/Test.py”,第14行,在中... ...原创 2023-12-13 19:55:35 · 1989 阅读 · 0 评论 -
解决:WARNING: Ignoring invalid distribution -ip (d:\python37\lib\site-packages)
背景为了使用之前的代码,搭建环境时,报错:WARNING: Ignoring invalid distribution -ip (d:\python37\lib\site-packages)翻译:```警告:忽略无效的分发-ip(d:\python37\lib\site软件包)```原因经过查阅资料,发现是这个错误产生的原因是之前安装插件失败或者中途退出,导致插件安装出现异常导致的。然后就会产生这样的错误提示。原创 2023-12-13 01:00:00 · 2004 阅读 · 0 评论 -
解决:TypeError: write() argument must be str, not Tag
背景在使用之前的代码时,报错:Traceback (most recent call last): File "E:/Test/test.py", line 14, in file.write(tag_str)TypeError: write() argument must be str, not Tag翻译:```追溯(最近一次通话):文件“E:/Test/Test.py”,第14行,在中file.write(tag_str)......原创 2023-12-12 12:45:00 · 1409 阅读 · 0 评论 -
解决:TypeError: Type ‘list’ cannot be serialized
背景在使用之前的代码时,报错:Traceback (most recent call last): File "E:/Test/test.py", line 14, in d = etree.tostring(divs) File "src/lxml/etree.py", line 3443, in lxml.etree.tostringTypeError: Type 'list' cannot be serialized.翻译:```追溯(最近一次调用)...原创 2023-12-12 09:30:00 · 1333 阅读 · 0 评论 -
解决SyntaxError:(unicode error)‘unicodeescape’ codec can’t decode bytes in position x:truncaed escape
背景在使用之前的代码时,报错:SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 378-379: truncated \UXXXXXXXX escape翻译:```SyntaxError:(unicode错误)“unicodeescape”编解码器无法解码位置378-379中的字节:截断\UXXXXXXXX转义```原因经过查阅资料,发现SyntaxError这个错误通常 ...原创 2023-12-11 19:00:00 · 8655 阅读 · 0 评论 -
解决:GuessedAtParserWarning:No parser was explicitly specified,so I‘m using the best available HTML...
背景在使用之前的代码时,报错:GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different ......原创 2023-12-11 12:54:44 · 1418 阅读 · 0 评论 -
解决:ModuleNotFoundError: No module named ‘docx‘
报错翻译主要报错信息内容翻译如下所示: Traceback (most recent call last): File "d:/develop/python/workspace/CreatorTools/读取和写入world.py", line 2, in import docxModuleNotFoundError: No module named 'docx'翻译:回溯(最近一次调用最后一次):文件“d:.... ...原创 2023-12-10 23:39:23 · 2583 阅读 · 0 评论 -
解决:Message: unknown error: failed to change window state to ‘normal‘, current state is ‘maximized‘
背景在使用之前的代码时,报错: Traceback (most recent call last): File "xxx", line xx, in driver.maximize_window() # 窗口最大化 selenium.common.exceptions.WebDriverException: Message: unknown error: failed to change window state to 'normal', ... ...原创 2023-12-09 10:00:00 · 784 阅读 · 0 评论 -
解决:ModuleNotFoundError: No module named ‘dlib‘
背景在使用之前的代码时,报错: Traceback (most recent call last): File "xxx", line xx, in import dlib ModuleNotFoundError: No module named 'dlib'翻译:```追溯(最近一次通话):文件“xxx”,第xx行,在导入dlibModuleNotFoundError:没有名为“dlib”的模块```原因经过查阅资料发现是这个错误通常是。。。原创 2023-12-09 01:43:50 · 3414 阅读 · 0 评论