本文共 3041 字,大约阅读时间需要 10 分钟。
一、can only concatenate str (not "Tag") to str
报错信息:Exception has occurred: TypeError
can only concatenate str (not "Tag") to str
File "F:\python_workspace\customs\extract.py", line 140, in containerInfo
item['\'' + titles[j] + '\''] = contents[i]
File "F:\python_workspace\customs\extract.py", line 59, in parseWeb
container_1_item = Extract.containerInfo(str(items[5]), str(titles[5]), myDb, url_id, county)
File "F:\python_workspace\customs\detail.py", line 78, in openTab
tarGetData = Extract.parseWeb(page, url_id)
File "F:\python_workspace\customs\detail.py", line 40, in callUpBrowser
self.openTab(driver, tarGetData)
File "F:\python_workspace\customs\detail.py", line 83, in
detail.callUpBrowser()
解决方案
二维数组的KEY中含有html标签
二、Value 'item_total.append' is unsubscriptable
报错信息:item_total.append[item]
-------------------------------
item_total: list
Value 'item_total.append' is unsubscriptablepylint(unsubscriptable-object)
解决方案
item_total.append[item]改为item_total.append(item)
三、can only concatenate str (not "NoneType") to str
报错信息:Exception has occurred: TypeError
can only concatenate str (not "NoneType") to str
File "F:\python_workspace\customs\extract.py", line 150, in containerInfo
item['\'' + titles[j].string + '\''] = contents[i].string
File "F:\python_workspace\customs\extract.py", line 66, in parseWeb
Extract.containerInfo(str(items[7]), str(titles[7]), myDb, url_id, county, 3)
File "F:\python_workspace\customs\detail.py", line 78, in openTab
tarGetData = Extract.parseWeb(page, url_id)
File "F:\python_workspace\customs\detail.py", line 40, in callUpBrowser
self.openTab(driver, tarGetData)
File "F:\python_workspace\customs\detail.py", line 83, in
detail.callUpBrowser()
解决方案
对处理的字符串做判断if string is None
四、Unable to add the Win32_PerfRawData_PerfDisk_PhysicalDisk enum
报错信息:[6668:6348:0625/111147.071:ERROR:wmi_refresher.cc(150)] Unable to add the Win32_PerfRawData_PerfDisk_PhysicalDisk enum.
解决方案加大time.sleep(5) 时间到一个合适的值
五、FutureWarning: Using an implicitly registered datetime converter for a matplotlib plotting method. The converter was registered by pandas on import. Future versions of pandas will require you to explicitly register matplotlib converters.
报错信息:FutureWarning: Using an implicitly registered datetime converter for a matplotlib plotting method. The converter was registered by pandas on import. Future versions of pandas will require you to explicitly register matplotlib converters.
To register the converters:
>>> from pandas.plotting import register_matplotlib_converters
>>> register_matplotlib_converters()
warnings.warn(msg, FutureWarning)
解决方案
添加报错信息中的代码from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
六:Unable to open 'parsers.pyx': Unable to read file
报错信息:Unable to open 'parsers.pyx': Unable to read file (Error: File not found (f:\python_workspace\pandas-example\pandas\_libs\parsers.pyx)).
解决方案**文件路径错误**
七:RuntimeError: already started
报错信息:raise RuntimeError('already started')
RuntimeError: already started
解决方案
vscode的问题,在终端或者命令行执行即可
转载地址:http://madqv.baihongyu.com/