zoukankan      html  css  js  c++  java
  • button的type属性引起的错误AttributeError: 'NoneType' object has no attribute 'split'

    button的type属性引起的错误 AttributeError: 'NoneType' object has no attribute 'split'

    最初button的写法:

    <button type="submit" class="btn btn-primary" onclick="save()">保存</button>
    

    点击button进行更新数据库数据时,提示错误:AttributeError: 'NoneType' object has no attribute 'split'

    Exception happened during processing of request from ('127.0.0.1', 59965)
    Traceback (most recent call last):
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 138, in run
        self.finish_response()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 180, in finish_response
        self.write(data)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 274, in write
        self.send_headers()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 332, in send_headers
        self.send_preamble()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 255, in send_preamble
        ('Date: %s
    ' % format_date_time(time.time())).encode('iso-8859-1')
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 453, in _write
        result = self.stdout.write(data)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libsocketserver.py", line 796, in write
        self._sock.sendall(b)
    ConnectionAbortedError: [WinError 10053] 確立された接続がホスト コンピューターのソウトウェアによって中止されました。
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 141, in run
        self.handle_error()
      File "E:ApiFreevenvlibsite-packagesdjangocoreserversasehttp.py", line 119, in handle_error
        super().handle_error()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 368, in handle_error
        self.finish_response()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 180, in finish_response
        self.write(data)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 274, in write
        self.send_headers()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 331, in send_headers
        if not self.origin_server or self.client_is_modern():
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.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:UsersTynamYangAppDataLocalProgramsPythonPython37-32libsocketserver.py", line 647, in process_request_thread
        self.finish_request(request, client_address)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libsocketserver.py", line 357, in finish_request
        self.RequestHandlerClass(request, client_address, self)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libsocketserver.py", line 717, in __init__
        self.handle()
      File "E:ApiFreevenvlibsite-packagesdjangocoreserversasehttp.py", line 174, in handle
        self.handle_one_request()
      File "E:ApiFreevenvlibsite-packagesdjangocoreserversasehttp.py", line 197, in handle_one_request
        handler.run(self.server.get_app())
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 144, in run
        self.close()
      File "E:ApiFreevenvlibsite-packagesdjangocoreserversasehttp.py", line 114, in close
        super().close()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefsimple_server.py", line 35, in close
        self.status.split(' ',1)[0], self.bytes_sent
    AttributeError: 'NoneType' object has no attribute 'split'
    ----------------------------------------
    [04/Nov/2020 15:36:21] "GET /child/welcome.html// HTTP/1.1" 200 2326
    [04/Nov/2020 15:36:21] "GET /static/jquery/jquery-3.5.0.min.js?_=1604471781302 HTTP/1.1" 200 89493
    [04/Nov/2020 15:36:23] "GET /project_list/ HTTP/1.1" 200 3272
    [04/Nov/2020 15:36:23] "GET /child/project_list.html// HTTP/1.1" 200 8245
    [04/Nov/2020 15:36:23] "GET /static/menu/js/jquery-1.11.0.min.js?_=1604471783119 HTTP/1.1" 200 96383
    [04/Nov/2020 15:36:23] "GET /static/menu/src/jquery-rvnm.js?_=1604471783120 HTTP/1.1" 200 12475
    [04/Nov/2020 15:36:23] "GET /static/bootstrap-4.5.3-dist/js/bootstrap.bundle.js?_=1604471783121 HTTP/1.1" 200 236517
    [04/Nov/2020 15:36:23] "GET /static/bootstrap-4.5.3-dist/js/bootstrap.js?_=1604471783122 HTTP/1.1" 200 143686
    [04/Nov/2020 15:36:24] "GET /apis/4/ HTTP/1.1" 200 3267
    [04/Nov/2020 15:36:24] "GET /child/P_apis.html/4/ HTTP/1.1" 200 2042
    [04/Nov/2020 15:36:24] "GET /static/menu/js/jquery-1.11.0.min.js?_=1604471784792 HTTP/1.1" 200 96383
    [04/Nov/2020 15:36:24] "GET /static/menu/src/jquery-rvnm.js?_=1604471784793 HTTP/1.1" 200 12475
    [04/Nov/2020 15:36:24] "GET /static/bootstrap-4.5.3-dist/js/bootstrap.bundle.js?_=1604471784794 HTTP/1.1" 200 236517
    [04/Nov/2020 15:36:24] "GET /static/bootstrap-4.5.3-dist/js/bootstrap.js?_=1604471784795 HTTP/1.1" 200 143686
    [04/Nov/2020 15:36:26] "GET /project_set/4/ HTTP/1.1" 200 3274
    [04/Nov/2020 15:36:26] "GET /child/P_project_set.html/4/ HTTP/1.1" 200 1461
    [04/Nov/2020 15:36:28] "GET /project_set/4/? HTTP/1.1" 200 3274
    [04/Nov/2020 15:36:28] "GET /save_project_set/4/?name=sdfafasdfasd&remark=2&other_user=2 HTTP/1.1" 200 0
    Traceback (most recent call last):
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 138, in run
        self.finish_response()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 180, in finish_response
        self.write(data)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 274, in write
        self.send_headers()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 332, in send_headers
        self.send_preamble()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 255, in send_preamble
        ('Date: %s
    ' % format_date_time(time.time())).encode('iso-8859-1')
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 453, in _write
        result = self.stdout.write(data)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libsocketserver.py", line 796, in write
        self._sock.sendall(b)
    ConnectionAbortedError: [WinError 10053] 確立された接続がホスト コンピューターのソウトウェアによって中止されました。
    [04/Nov/2020 15:36:28] "GET /save_project_set/4/?name=sdfafasdfasd&remark=2&other_user=2 HTTP/1.1" 500 59
    ----------------------------------------
    Exception happened during processing of request from ('127.0.0.1', 59966)
    Traceback (most recent call last):
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 138, in run
        self.finish_response()
    [04/Nov/2020 15:36:28] "GET /child/P_project_set.html/4/ HTTP/1.1" 200 1461
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 180, in finish_response
        self.write(data)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 274, in write
        self.send_headers()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 332, in send_headers
        self.send_preamble()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 255, in send_preamble
        ('Date: %s
    ' % format_date_time(time.time())).encode('iso-8859-1')
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 453, in _write
        result = self.stdout.write(data)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libsocketserver.py", line 796, in write
        self._sock.sendall(b)
    ConnectionAbortedError: [WinError 10053] 確立された接続がホスト コンピューターのソウトウェアによって中止されました。
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 141, in run
        self.handle_error()
      File "E:ApiFreevenvlibsite-packagesdjangocoreserversasehttp.py", line 119, in handle_error
        super().handle_error()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 368, in handle_error
        self.finish_response()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 180, in finish_response
        self.write(data)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 274, in write
        self.send_headers()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 331, in send_headers
        if not self.origin_server or self.client_is_modern():
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.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:UsersTynamYangAppDataLocalProgramsPythonPython37-32libsocketserver.py", line 647, in process_request_thread
        self.finish_request(request, client_address)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libsocketserver.py", line 357, in finish_request
        self.RequestHandlerClass(request, client_address, self)
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libsocketserver.py", line 717, in __init__
        self.handle()
      File "E:ApiFreevenvlibsite-packagesdjangocoreserversasehttp.py", line 174, in handle
        self.handle_one_request()
      File "E:ApiFreevenvlibsite-packagesdjangocoreserversasehttp.py", line 197, in handle_one_request
        handler.run(self.server.get_app())
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefhandlers.py", line 144, in run
        self.close()
      File "E:ApiFreevenvlibsite-packagesdjangocoreserversasehttp.py", line 114, in close
        super().close()
      File "C:UsersTynamYangAppDataLocalProgramsPythonPython37-32libwsgirefsimple_server.py", line 35, in close
        self.status.split(' ',1)[0], self.bytes_sent
    AttributeError: 'NoneType' object has no attribute 'split'
    ----------------------------------------
    

      解决方法,修正button的type:

    <button type="button" class="btn btn-primary" onclick="save()">保存</button>
    

      在次操作按钮,数据库更新成功

  • 相关阅读:
    MDA模型定义及扩展
    java中 i = i++和 j = i++ 的区别
    nginx+tomcat负载均衡和session复制
    HDU 4010.Query on The Trees 解题报告
    codeforces 165D.Beard Graph 解题报告
    zoj 3209.Treasure Map(DLX精确覆盖)
    hdu 1155 Bungee Jumping
    选择Nginx的理由
    九九乘法表
    K
  • 原文地址:https://www.cnblogs.com/tynam/p/13925863.html
Copyright © 2011-2022 走看看