Django(Python)AttributeError:“NoneType”对象没有属性“split”

2024-09-26 22:52:28 发布

您现在位置:Python中文网/ 问答频道 /正文

当我访问post页面时,我得到一个奇怪的错误。我做的网页应用程序,你可以张贴图像和视频。对于图像,它可以正常工作,但当我发布视频并转到其页面时,服务器会给出以下输出:

Traceback (most recent call last):
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 138, in run
    self.finish_response()
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 180, in finish_response
    self.write(data)
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 279, in write
    self._write(data)
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 453, in _write
    self.stdout.write(data)
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 593, in write
    return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
[15/May/2016 13:50:09] "GET /media/uploads/Big_Buck_Bunny_Final.mp4 HTTP/1.1" 500 59

----------------------------------------

Exception happened during processing of request from ('127.0.0.1', 23943)
[15/May/2016 13:50:09] "GET /static/image/video-poster.jpg HTTP/1.1" 304 0
Traceback (most recent call last):
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 138, in run
    self.finish_response()
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 180, in finish_response
    self.write(data)
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 279, in write
    self._write(data)
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 453, in _write
    self.stdout.write(data)
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 593, in write
    return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 141, in run
    self.handle_error()
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\servers\basehttp.py", line 92, in handle_error
    super(ServerHandler, self).handle_error()
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 368, in handle_error
    self.finish_response()
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 180, in finish_response
    self.write(data)
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 274, in write
    self.send_headers()
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 331, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\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:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 628, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 357, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\servers\basehttp.py", line 99, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\socketserver.py", line 684, in __init__
    self.handle()
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\site-packages\django\core\servers\basehttp.py", line 179, in handle
    handler.run(self.server.get_app())
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\handlers.py", line 144, in run
    self.close()
  File "C:\Users\Slavko\AppData\Local\Programs\Python\Python35-32\lib\wsgiref\simple_server.py", line 35, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'

图像和视频的代码是一样的,这就是为什么我不明白这一点。 以下是我的查看功能,当您访问post页面时使用:

^{pr2}$

可能它有一些与状态代码在回应,但为什么它不显示时,图像加载和如何可以修复它?在


Tags: inpyselfliblocalhandlerslineusers

热门问题