博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
AttributeError: 'NoneType' object has no attribute 'split' 报错处理
阅读量:5982 次
发布时间:2019-06-20

本文共 3737 字,大约阅读时间需要 12 分钟。

报错场景

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 0Traceback (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 subscriptableDuring 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_sentAttributeError: 'NoneType' object has no attribute 'split'----------------------------------------

解决方式

姑且这样子可以解决, 但是不知道这样会不会造成不好的影响

 

转载于:https://www.cnblogs.com/shijieli/p/10791247.html

你可能感兴趣的文章
Spring可扩展Schema标签
查看>>
c++ STL unique , unique_copy函数
查看>>
http://miicaa.yopwork.com/help/overall/
查看>>
浅谈关于特征选择算法与Relief的实现
查看>>
mybatis-spring 项目简介
查看>>
Wireshark抓取RTP包,还原语音
查看>>
Behavioral模式之Memento模式
查看>>
Work Management Service application in SharePoint 2016
查看>>
Dos 改动IP 地址
查看>>
Laravel 源码解读:php artisan make:auth
查看>>
【转】ionic run android 成功launch success,但是genymotion虚拟机没有显示
查看>>
苹果在GitHub上正式开源iOS内核源码
查看>>
测试人员面临的测试挑战和必备技能
查看>>
使用Flutter之后,我们的CPU占用率降了50%
查看>>
同事反馈环:为什么度量和会议还不够充分
查看>>
[转]十问 Linux 虚拟内存管理 (glibc)
查看>>
老司机带你深入浅出 Collection
查看>>
查询系统-vba
查看>>
[译]Spring Session 与 Spring Security
查看>>
python学习笔记(05)
查看>>