wagtail: Keep hitting "AttributeError: 'NoneType' object has no attribute 'split'" in Windows 10

Issue Summary

I’m trying out wagtail on Windows 10 and I constantly see errors in the runserver log output pointing to errors in the http request status excepted in c:\program files\python35\Lib\wsgiref\simple_server.py.

Steps to Reproduce

It’s essential that you provide enough information for someone else to replicate the problem you’re seeing. Simply describing something that’s broken on your current project is not enough!

  1. Set up a virtual environment in Windows 10 with Python 3.5
  2. Run through the instructions at http://docs.wagtail.io/en/stable/getting_started/tutorial.html
  3. By the time you’ve updated the homepage, you’ll have seen this error many times already.

This may be a bug in Python’s wsgi server but it’s far more likely that wagtail is generating an error (due to perhaps not being able to resolve an asset in an unexpected way) which only surfaces once the wsgi code tries to access the corresponding request’s status.

Technical details

  • Virtualenv version: 15.1.0
  • Python version: 3.5.2
  • Django version: 1.11.10
  • Wagtail version: 1.13.1
  • Browser version: Firefox 60
  • Operating System: Windows 10 x64

Log output

This is my log output when I got to the Blog implementation section - the error occurs many many times before then, too:

(venv) i:\temp\mysite>manage makemigrations && manage migrate && manage runserver
Migrations for 'blog':
  blog\migrations\0002_blogpage.py
    - Create model BlogPage
Operations to perform:
  Apply all migrations: admin, auth, blog, contenttypes, home, sessions, taggit, wagtailadmin, wagtailcore, wagtaildocs, wagtailembeds, wagtailforms, wagtailimages, wagtailredirects, wagtailsearch, wagtailusers
Running migrations:
  Applying blog.0002_blogpage... OK
Performing system checks...

System check identified no issues (0 silenced).
February 08, 2018 - 10:59:30
Django version 1.11.10, using settings 'mysite.settings.dev'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[08/Feb/2018 11:00:14] "GET /admin/pages/4/edit/ HTTP/1.1" 200 21893
[08/Feb/2018 11:00:14] "GET /static/wagtailadmin/fonts/robotoslab-regular.woff2 HTTP/1.1" 200 87596
[08/Feb/2018 11:00:17] "GET /admin/api/v2beta/pages/?child_of=1 HTTP/1.1" 200 1079
[08/Feb/2018 11:00:22] "GET /admin/api/v2beta/pages/?child_of=3 HTTP/1.1" 200 1093
[08/Feb/2018 11:00:24] "GET /admin/pages/4/ HTTP/1.1" 200 13076
[08/Feb/2018 11:00:26] "GET /admin/pages/4/add_subpage/ HTTP/1.1" 200 9515
[08/Feb/2018 11:00:28] "GET /admin/pages/add/blog/blogpage/4/ HTTP/1.1" 200 21335
[08/Feb/2018 11:00:48] "POST /admin/pages/add/blog/blogpage/4/ HTTP/1.1" 302 0
[08/Feb/2018 11:00:48] "GET /admin/pages/4/ HTTP/1.1" 200 16688
[08/Feb/2018 11:00:50] "GET /admin/pages/4/add_subpage/ HTTP/1.1" 200 9515
[08/Feb/2018 11:00:51] "GET /admin/pages/add/blog/blogpage/4/ HTTP/1.1" 200 21335
[08/Feb/2018 11:01:08] "POST /admin/pages/add/blog/blogpage/4/ HTTP/1.1" 302 0
[08/Feb/2018 11:01:08] "GET /admin/pages/4/ HTTP/1.1" 200 19959
[08/Feb/2018 11:01:12] "GET /blog/ HTTP/1.1" 200 3167
[08/Feb/2018 11:01:12] "GET /static/css/mysite.css HTTP/1.1" 304 0
[08/Feb/2018 11:01:12] "GET /static/wagtailadmin/css/userbar.css HTTP/1.1" 200 14239
[08/Feb/2018 11:01:12] "GET /static/js/mysite.js HTTP/1.1" 304 0
[08/Feb/2018 11:01:12] "GET /static/wagtailadmin/js/userbar.js HTTP/1.1" 304 0
[08/Feb/2018 11:01:13] "GET /static/wagtailadmin/fonts/wagtail.ttf HTTP/1.1" 200 22896
[08/Feb/2018 11:01:13] "GET /static/wagtailadmin/fonts/opensans-regular.woff2 HTTP/1.1" 200 68812
[08/Feb/2018 11:01:15] "GET /blog/blog-post-2/ HTTP/1.1" 200 2940
[08/Feb/2018 11:01:15] "GET /static/wagtailadmin/css/userbar.css HTTP/1.1" 200 8192
Traceback (most recent call last):
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 138, in run
    self.finish_response()
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 180, in finish_response
    self.write(data)
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 274, in write
    self.send_headers()
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 332, in send_headers
    self.send_preamble()
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 255, in send_preamble
    ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "c:\program files\python35\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
[08/Feb/2018 11:01:15] "GET /static/wagtailadmin/css/userbar.css HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 62192)
Traceback (most recent call last):
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 138, in run
    self.finish_response()
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 180, in finish_response
    self.write(data)
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 274, in write
    self.send_headers()
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 332, in send_headers
    self.send_preamble()
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 255, in send_preamble
    ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "c:\program files\python35\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:\program files\python35\Lib\wsgiref\handlers.py", line 141, in run
    self.handle_error()
  File "i:\temp\venv\lib\site-packages\django\core\servers\basehttp.py", line 88, in handle_error
    super(ServerHandler, self).handle_error()
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 368, in handle_error
    self.finish_response()
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 180, in finish_response
    self.write(data)
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 274, in write
    self.send_headers()
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 331, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "c:\program files\python35\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:\program files\python35\Lib\socketserver.py", line 625, in process_request_thread
    self.finish_request(request, client_address)
  File "c:\program files\python35\Lib\socketserver.py", line 354, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "c:\program files\python35\Lib\socketserver.py", line 681, in __init__
    self.handle()
  File "i:\temp\venv\lib\site-packages\django\core\servers\basehttp.py", line 155, in handle
    handler.run(self.server.get_app())
  File "c:\program files\python35\Lib\wsgiref\handlers.py", line 144, in run
    self.close()
  File "c:\program files\python35\Lib\wsgiref\simple_server.py", line 36, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
[08/Feb/2018 11:01:17] "GET /blog/ HTTP/1.1" 200 3167

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 16 (5 by maintainers)

Most upvoted comments

FWIW, I ran into similar issue when using a Firefox browser, but didnt see any erros when I used Chrome.

I had the same problems on another application. It was solved by setting DATA_UPLOAD_MAX_NUMBER_FIELDS = in settings.py Standard is 1000 or 2000, I did set it to 10000 Django 2.2 in combination with sqlexpress on Windows 10

@ram40193 @ruthnphillips closed issues are not the right place to talk about this. If you have an error case that is not solved by the above comments, then you have a new issue and you should probably ask about it on stackoverflow first (with an mcve) as the preferred support solution, only using github once it turns it out it really is a bug in wagtail.

Are you using PostgreSQL? It could be caused by a code page error.

C:\>psql -U postgres
psql (10.5)
WARNING: Console code page (850) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

postgres=#

Trying setting the code page before you start Django.

cmd.exe /c chcp 1252

Yes and no. In development mode (DEBUG = True), the server looks for static files at locations defined in the finders, so there’s no need to run manage.py collectstatic; in production, the finders determine the locations that manage.py collectstatic copies files from, so the finders are used in both cases. Please see the Django docs: https://docs.djangoproject.com/en/2.0/howto/static-files/

I figured the issue is with Database. Mostly SQLLite When you make any changes with DB and you forget to commit or revert it, the Database gets into the locked mode, that is the time you encounter this issue. Go to the Database and revert or commit the change to unlock it and everything will be back to normal.

Bear in mind that this 500 error is apparently happening on a static CSS file, and there’s very little (if anything) Wagtail-specific about how they are served - it may well be worth setting up a vanilla Django project, with a ‘hello world’ page and a few CSS/JS files linked from it, and seeing if the error occurs there too.

(If Wagtail is doing something different to the Django defaults, the differences should be confined to the settings (STATICFILES_FINDERS etc) and urls.py.)