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' 因为如果是 ...
随机推荐
- 配置CLion作为Qt5开发环境
使用Qt进行程序开发时QtCreator总是不二之选.作为老牌IDE在提供了强大的功能同时也对Qt的支持做了许多优化.如果没有特别的原因你应该使用它. 然而一个顺手的工具将会极大得提升生产效率,而如果 ...
- WPR003N变成尸体的后记
这是一个很悲哀的标题,尽管本来不想说还是打算写出来. 应小便的要求本文不加任何字体变化,不设置玄关来等大家破解,只是很自然的把悲剧和大家分享一下. 自上回2019 Valentine's Day 圣地 ...
- C# 曲线上的点(一) 获取指定横坐标对应的纵坐标值
获取直线上的点,很容易,那曲线呢?二阶贝塞尔.三阶贝塞尔.多段混合曲线,如何获取指定横坐标对应的纵坐标? 如下图形: 实现方案 曲线上的点集 Geometry提供了一个函数GetFlattenedPa ...
- Cookie 数据浅谈
Cookie 是一些数据, 存储于你电脑上的文本文件中. 当 web 服务器向浏览器发送 web 页面时,在连接关闭后,服务端不会记录用户的信息. Cookie 的作用就是用于解决 "如 ...
- Django用户继承AbstractUser后密码为明文
Django用户继承AbstractUser后密码为明文 其实本不应该有这个问题,却花了我很久的时间,因为还是初学阶段. 造成这个原因是因为在admin注册的生活没有指定Admin 在app的admi ...
- 只需一行代码!Python中9大时间序列预测模型
在时间序列问题上,机器学习被广泛应用于分类和预测问题.当有预测模型来预测未知变量时,在时间充当独立变量和目标因变量的情况下,时间序列预测就出现了. 预测值可以是潜在雇员的工资或银行账户持有人的信用评分 ...
- nginx性能优化(针对于高并发量仅供参考,并不是方案)
目录 关于nginx.conf中的优化 配置nginx客户端网页缓存本地时间 nginx日志切割 nginx连接超时优化 Nginx 实现网页压缩功能 Nginx 实现防盗链功能 为目录添加访问控制 ...
- 探索SQL Server元数据(一)
简介 在数据库中,我们除了存储数据外,还存储了大量的元数据.它们主要的作用就是描述数据库怎么建立.配置.以及各种对象的属性等.本篇简单介绍如何使用和查询元数据,如何更有效的管理SQLServer 数据 ...
- Windows -- 从注册表删除IE浏览器加载项
Windows -- 从注册表删除IE浏览器加载项 1. 一部分加载项从注册表以下位置直接删除 2. 一部分扩展项从注册表以下位置直接删除
- apache ranger源码编译
官方文档 http://ranger.apache.org/quick_start_guide.html Quick Start Guide Build Process 1. Check out th ...