[Django] #30378: AttributeError: 'NoneType' object has no attribute 'split'

726 views
Skip to first unread message

Django

unread,
Apr 17, 2019, 2:58:36 AM4/17/19
to django-...@googlegroups.com
#30378: AttributeError: 'NoneType' object has no attribute 'split'
-----------------------------------------+------------------------
Reporter: PM | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
I'm writing very simple code while learning Django. I noticed there is
some error in the server console window sometimes when I refreshed my
browser.

The error always ends with the line in the ticket Summary. The following
is the entire copy of the error.
What the strange is everything works good except the error information.
Nothing is broken. The view is always rendered properly. Any idea what it
is mean?


{{{
[17/Apr/2019 14:52:40] "GET /favicon.ico HTTP/1.1" 404 2189
Traceback (most recent call last):
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 180, in
finish_response
self.write(data)
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 332, in
send_headers
self.send_preamble()
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 255, in
send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Python\Python37\lib\socketserver.py", line 799, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was
aborted by the software in your host machine
[17/Apr/2019 14:52:40] "GET /favicon.ico HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 55341)
Traceback (most recent call last):
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 180, in
finish_response
self.write(data)
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 332, in
send_headers
self.send_preamble()
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 255, in
send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Python\Python37\lib\socketserver.py", line 799, in write
self._sock.sendall(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:\Python\Python37\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\PythonCode\SeaMotor\venv\lib\site-
packages\django\core\servers\basehttp.py", line 116, in handle_error
super().handle_error()
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 368, in
handle_error
self.finish_response()
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 180, in
finish_response
self.write(data)
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 331, in
send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python\Python37\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:\Python\Python37\lib\socketserver.py", line 650, in
process_request_thread
self.finish_request(request, client_address)
File "C:\Python\Python37\lib\socketserver.py", line 360, in
finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python\Python37\lib\socketserver.py", line 720, in __init__
self.handle()
File "C:\PythonCode\SeaMotor\venv\lib\site-
packages\django\core\servers\basehttp.py", line 171, in handle
self.handle_one_request()
File "C:\PythonCode\SeaMotor\venv\lib\site-
packages\django\core\servers\basehttp.py", line 194, in handle_one_request
handler.run(self.server.get_app())
File "C:\Python\Python37\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\PythonCode\SeaMotor\venv\lib\site-
packages\django\core\servers\basehttp.py", line 111, in close
super().close()
File "C:\Python\Python37\lib\wsgiref\simple_server.py", line 35, in
close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30378>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 17, 2019, 2:59:39 AM4/17/19
to django-...@googlegroups.com
#30378: AttributeError: 'NoneType' object has no attribute 'split'
-------------------------------+--------------------------------------

Reporter: PM | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by PM:

Old description:

New description:

I'm writing very simple code while learning Django. I noticed there is
some error in the server console window sometimes when I refreshed my
browser.

The error always ends with the line in the ticket Summary. The following
is the entire copy of the error.
What the strange is everything works good except the error information.

Nothing is broken. The view is always rendered properly. Also, this error
doesn't always happen. It occurs occasionally. Any idea what it is mean?

--

--
Ticket URL: <https://code.djangoproject.com/ticket/30378#comment:1>

Django

unread,
Apr 17, 2019, 3:00:14 AM4/17/19
to django-...@googlegroups.com
#30378: AttributeError: 'NoneType' object has no attribute 'split'
-------------------------------+--------------------------------------

Reporter: PM | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.1
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by PM:

Old description:

> I'm writing very simple code while learning Django. I noticed there is


> some error in the server console window sometimes when I refreshed my
> browser.
>
> The error always ends with the line in the ticket Summary. The following
> is the entire copy of the error.
> What the strange is everything works good except the error information.

> Nothing is broken. The view is always rendered properly. Also, this error

> doesn't always happen. It occurs occasionally. Any idea what it is mean?
>

New description:

I'm writing very simple code while learning Django. I noticed there is
some error in the server console window sometimes when I refreshed my
browser.

The error always ends with the line in the ticket Summary. The following
is the entire copy of the error.
What the strange is everything works good except the error information.

Nothing is broken. The view is always rendered properly. Also, this error

doesn't always happen. It occurs occasionally. Any idea of what it means?

--

--
Ticket URL: <https://code.djangoproject.com/ticket/30378#comment:2>

Django

unread,
Apr 17, 2019, 4:07:14 AM4/17/19
to django-...@googlegroups.com
#30378: AttributeError: 'NoneType' object has no attribute 'split'
------------------------------+--------------------------------------
Reporter: PM | Owner: nobody
Type: Bug | Status: closed
Component: Core (Other) | Version: master
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by felixxm):

* status: new => closed
* type: Uncategorized => Bug
* version: 2.1 => master
* component: Uncategorized => Core (Other)
* resolution: => duplicate


Comment:

Duplicate of #30377.

--
Ticket URL: <https://code.djangoproject.com/ticket/30378#comment:3>

Django

unread,
Jan 18, 2021, 1:40:37 AM1/18/21
to django-...@googlegroups.com
#30378: AttributeError: 'NoneType' object has no attribute 'split'
------------------------------+--------------------------------------
Reporter: PM | Owner: nobody

Type: Bug | Status: closed
Component: Core (Other) | Version: master
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------

Comment (by linehammer):

The AttributeError is an exception thrown when an object does not have the
attribute you tried to access. 'NoneType' object has no attribute 'split'
often indicates that the attribute you are trying to split is Null,
meaning there is no value in it to [http://net-
informations.com/python/file/split.htm split]. So, you need to check the
attribute is not Null before splitting. Something like..

if val is not None:
# ...

--
Ticket URL: <https://code.djangoproject.com/ticket/30378#comment:4>

Reply all
Reply to author
Forward
0 new messages