AttributeError: 'NoneType' object has no attribute 'split' 报错处理
报错场景
social_django 组件对原生 django 的支持较好, 但是因为 在此DRF进行的验证为 JWT 方式 和 django 的验证存在区别,
因此需要进行更改自行支持 JWT 方式的验证信息的加入
更改后再验证第三方登录时发生如下报错
详细报错
[29/Apr/2019 15:12:02] "GET / HTTP/1.1" 200 6992
[29/Apr/2019 15:12:11] "GET /login/weibo/ HTTP/1.1" 302 0
[29/Apr/2019 15:12:13] "GET /complete/weibo/?state=cpNja8cxhyV9GPSKvjVfWnwogNskNjob&code=ba1e4f6fd32f32d0b57094eecd0e7d1b HTTP/1.1" 302 0
Traceback (most recent call last):
File "C:\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python36\lib\wsgiref\headers.py", line 142, in __bytes__
return str(self).encode('iso-8859-1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 251-253: ordinal not in range(256)
[29/Apr/2019 15:12:13] "GET /complete/weibo/?state=cpNja8cxhyV9GPSKvjVfWnwogNskNjob&code=ba1e4f6fd32f32d0b57094eecd0e7d1b HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 11977)
Traceback (most recent call last):
File "C:\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python36\lib\wsgiref\headers.py", line 142, in __bytes__
return str(self).encode('iso-8859-1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 251-253: ordinal not in range(256) During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "C:\Python36\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python36\lib\site-packages\django\core\servers\basehttp.py", line 88, in handle_error
super(ServerHandler, self).handle_error()
File "C:\Python36\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python36\lib\wsgiref\handlers.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "C:\Python36\lib\socketserver.py", line 639, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python36\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python36\lib\socketserver.py", line 696, in __init__
self.handle()
File "C:\Python36\lib\site-packages\django\core\servers\basehttp.py", line 155, in handle
handler.run(self.server.get_app())
File "C:\Python36\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python36\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
解决方式
姑且这样子可以解决, 但是不知道这样会不会造成不好的影响
AttributeError: 'NoneType' object has no attribute 'split' 报错处理的更多相关文章
- python3 AttributeError: 'NoneType' object has no attribute 'split'
from wsgiref.simple_server import make_server def RunServer(environ, start_response): start_response ...
- 解决AttributeError: 'Ui_MainWindow' object has no attribute 'show'报错
1.首先使用pyqt designer来设计ui界面,将其保存为"***.ui"文件, 然后进入到pyqt所在的文件目录中,执行cmd中命令,即在当前目录中可以生成相应的**.py ...
- django' 前端 self.status.split(' ',1)[0], self.bytes_sent AttributeError: 'NoneType' object has no attribute 'split'
form 表单 post之后 ,重新定向当前页面的get请求 这是因为,form表单提交的时候,按钮在form表单里面
- Keras AttributeError 'NoneType' object has no attribute '_inbound_nodes'
问题说明: 首先呢,报这个错误的代码是这行代码: model = Model(inputs=input, outputs=output) 报错: AttributeError 'NoneType' o ...
- AttributeError: 'NoneType' object has no attribute 'extend'
Python使用中可能遇到的小问题 AttributeError: 'NoneType' object has no attribute 'extend' 或者AttributeError: 'Non ...
- python提示AttributeError: 'NoneType' object has no attribute 'append'【转发】
在写python脚本时遇到AttributeError: 'NoneType' object has no attribute 'append' a=[] b=[1,2,3,4] a = a.appe ...
- python提示AttributeError: 'NoneType' object has no attribute 'append'
在写python脚本时遇到AttributeError: 'NoneType' object has no attribute 'append' a=[] b=[1,2,3,4] a = a.appe ...
- pyspark AttributeError: 'NoneType' object has no attribute 'setCallSite'
pyspark: AttributeError: 'NoneType' object has no attribute 'setCallSite' 我草,是pyspark的bug.解决方法: prin ...
- 解决opencv:AttributeError: 'NoneType' object has no attribute 'copy'
情况一: 路径中有中文,更改即可 情况二:可以运行代码,在运行结束时显示 AttributeError: 'NoneType' object has no attribute 'copy' 因为如果是 ...
随机推荐
- FSLIB.NETWORK 简易使用指南
1.介绍 FSLIB.NETWORK 是一款开源HTTP的高性能高易用性网络库,是对HttpWebRequest/HttpWebResponse的包装,目的是为了用起来更简单明了.设计的时候就为了提供 ...
- 《C#并发编程经典实例》学习笔记—2.2 返回完成的任务
问题: 如何实现一个具有异步签名的同步方法. 从异步接口或基类继承代码,但希望用同步方式实现方法. 解释一下所谓的异步接口和异步基类.例如如下代码 interface IMyAsyncInterfac ...
- ## 本篇文章对linux常用的一些命令做一下总结,如有需要补充以及不懂得地方,请在下方留言 适合于linux初学者,以及对命令掌握不牢的用来备忘
本篇文章对linux常用的一些命令做一下总结,如有需要补充以及不懂得地方,请在下方留言 适合于linux初学者,以及对命令掌握不牢的用来备忘一,磁盘管理1.显示当前目录位置 pwd2.切换目录 cd ...
- mysql入门知识
数据库 什么是数据库就是存储数据的仓库(容器) 存储数据的方式1.变量 无法永久存储2.文件处理 ,可以永久存储 文件处理存在的弊端: 1.文件处理速度慢 2.文件只能在自己的计算机上读写 无法被共享 ...
- Python绘图与可视化
Python有很多可视化工具,本篇只介绍Matplotlib. Matplotlib是一种2D的绘图库,它可以支持硬拷贝和跨系统的交互,它可以在Python脚本.IPython的交互环境下.Web应用 ...
- MyDAL - .Where() & .And() & .Or() 使用
索引: 目录索引 一.API 列表 1.Where .Where(Func<M, bool> func) 如: .Where( it => (it.Prop1>=条件1 &am ...
- Redis入门教程(一)
一.NoSQL概述 1.什么是NoSQL NoSQL,泛指非关系型的数据库.随着互联网web2.0网站的兴起,传统的关系数据库在应付web2.0网站,特别是超大规模和高并发的SNS类型的web2.0纯 ...
- C# ComboBox绑定值问题
使用这种方式始终绑定值有问题: cbxSchool.DataSource = schoolList; cbxSchool.DisplayMember = "school_name" ...
- python高级(4)—— 虚拟环境安装使用
虚拟环境 什么是虚拟环境 对电脑稍微有点常识的朋友相信都玩过,比如VMware,virtualbox,或者你用电脑端的模拟器玩手机端的游戏也是一样,其实就是一个假的空间,在Python这里,虚拟环境就 ...
- linux的常用命令介绍
1.ls 列出当前目录下的所有的文件和文件夹的名称. 参数如下:-a 显示隐藏文件 -l 显示方式为列表 -h 以可读性高的方式输出 eg: ls -lh /logs/tran 目录如果不指定(相 ...