Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'split' #74

Open
brandon-clair opened this issue Mar 15, 2018 · 18 comments
Open

AttributeError: 'NoneType' object has no attribute 'split' #74

brandon-clair opened this issue Mar 15, 2018 · 18 comments

Comments

@brandon-clair
Copy link

brandon-clair commented Mar 15, 2018

I'm running Python 3.5 and Django 2.0.2.

After installing django-sslserver, I'm seeing an exception whenever there's any sort of POST to my localhost server. It doesn't yet seem to be causing any problems, but any advice would be appreciated.

Here's the traceback:

Traceback (most recent call last):
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 279, in write
    self._write(data)
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib/python3.5/socket.py", line 593, in write
    return self._sock.send(b)
  File "/usr/lib/python3.5/ssl.py", line 861, in send
    return self._sslobj.write(data)
  File "/usr/lib/python3.5/ssl.py", line 586, in write
    return self._sslobj.write(data)
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1844)
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 46760)
Traceback (most recent call last):
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 279, in write
    self._write(data)
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib/python3.5/socket.py", line 593, in write
    return self._sock.send(b)
  File "/usr/lib/python3.5/ssl.py", line 861, in send
    return self._sslobj.write(data)
  File "/usr/lib/python3.5/ssl.py", line 586, in write
    return self._sslobj.write(data)
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1844)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 141, in run
    self.handle_error()
  File "/home/user/git_projects/django/env/lib/python3.5/site-packages/django/core/servers/basehttp.py", line 86, in handle_error
    super().handle_error()
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 368, in handle_error
    self.finish_response()
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 331, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "/usr/lib/python3.5/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 "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 341, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.5/socketserver.py", line 681, in __init__
    self.handle()
  File "/home/user/git_projects/django/env/lib/python3.5/site-packages/django/core/servers/basehttp.py", line 154, in handle
    handler.run(self.server.get_app())
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 144, in run
    self.close()
  File "/usr/lib/python3.5/wsgiref/simple_server.py", line 36, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
@brandon-clair
Copy link
Author

Also, here's what I have installed in my virtualenv:

Package                  Version  
------------------------ ---------
Babel                    2.5.3    
beautifulsoup4           4.6.0    
certifi                  2018.1.18
chardet                  3.0.4    
defusedxml               0.5.0    
Django                   2.0.2    
django-phonenumber-field 2.0.0    
django-sslserver         0.20     
html5lib                 1.0.1    
idna                     2.6      
oauthlib                 2.0.6    
phonenumberslite         8.9.1    
pip                      9.0.1    
psycopg2-binary          2.7.4    
PyJWT                    1.6.0    
python3-openid           3.1.0    
pytz                     2018.3   
requests                 2.18.4   
requests-oauthlib        0.8.0    
setuptools               38.5.1   
six                      1.11.0   
social-auth-app-django   2.1.0    
social-auth-core         1.7.0    
urllib3                  1.22     
webencodings             0.5.1    
wheel                    0.30.0  

@germancollado
Copy link

Hi, same here: Python 3.5.2 / Django 2.0.3

Traceback (most recent call last):
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 279, in write
    self._write(data)
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib/python3.5/socket.py", line 593, in write
    return self._sock.send(b)
  File "/usr/lib/python3.5/ssl.py", line 861, in send
    return self._sslobj.write(data)
  File "/usr/lib/python3.5/ssl.py", line 586, in write
    return self._sslobj.write(data)
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1844)
----------------------------------------
Exception happened during processing of request from ('192.168.30.221', 58560)
Traceback (most recent call last):
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 279, in write
    self._write(data)
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib/python3.5/socket.py", line 593, in write
    return self._sock.send(b)
  File "/usr/lib/python3.5/ssl.py", line 861, in send
    return self._sslobj.write(data)
  File "/usr/lib/python3.5/ssl.py", line 586, in write
    return self._sslobj.write(data)
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1844)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 141, in run
    self.handle_error()
  File "/home/german/.virtualenvs/beta10-api/lib/python3.5/site-packages/django/core/servers/basehttp.py", line 86, in handle_error
    super().handle_error()
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 368, in handle_error
    self.finish_response()
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 331, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "/usr/lib/python3.5/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 "/usr/lib/python3.5/socketserver.py", line 313, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 341, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.5/socketserver.py", line 681, in __init__
    self.handle()
  File "/home/german/.virtualenvs/beta10-api/lib/python3.5/site-packages/django/core/servers/basehttp.py", line 154, in handle
    handler.run(self.server.get_app())
  File "/usr/lib/python3.5/wsgiref/handlers.py", line 144, in run
    self.close()
  File "/usr/lib/python3.5/wsgiref/simple_server.py", line 36, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'

@davep
Copy link

davep commented May 7, 2018

I'm currently running into the same issue too with a test application. Has anyone managed to identify the cause of this?

@eavive
Copy link

eavive commented May 9, 2018

I see same errors with Python 3.5.2 + Django 2.0.3 on Ubuntu 16.04
When using Django 2.0.1 no errors appear.

Though I don't use django-sslserver at all.
Ended up here after searching Google for this error output.

I do use:
Django==2.0.3
django-extensions==2.0.5
django-filter==1.1.0
django-rest-framework-mongoengine==3.3.1
djangorestframework==3.7.7

@gohanko
Copy link

gohanko commented May 18, 2018

I think this might be an issue with django 2.0 itself, I noticed this error in 3 of my django project.

@brandon-clair
Copy link
Author

tl;dr: pip install --force-reinstall requests[security] ...maybe

So I don't use this package anymore, but for those looking for a solution, the exception may be due to additional requirements in the requests package, and could potentially be solved by explicitly installing the requirements. It also seemed to help out over in a similar issue, but forcing a re-installation.

The exception certainly is coming from something outside of django-sslserver itself, so if anyone has success with the above, let us know so we could close this issue, with maybe just an update to requirements.txt.

@AntJLopez
Copy link

As suggested, I tried:
pip install --force-reinstall requests[security]

I am still experiencing the issue. Everything seems to be working properly, but the command line is flooded with these errors. It happens with every one of my Django projects.

I am using Python 3.7.0 and Django 2.1.

@ssokolow
Copy link

ssokolow commented Aug 9, 2018

Judging by the traceback, this looks like the same error detailed in issue #31.

Note that the AttributeError is the result of a chain of During handling of the above exception, another exception occurred: lines.

@Allan-Nava
Copy link

How can I fix this problem?

@captbilard
Copy link

Am also having this issue now, and based on google search it seems like its a Django thing.
I created a form using ModelForm and when I try to save it to the DB. My console is flooded with the error message. I hope this is fixed soon.

@abhishek-malik
Copy link

I'm facing the same issue while working on windows and using firefox browser, whereas application is running fine on Ubuntu. Looks like there is some problem with the firewall processing the http requests.
This might help : wagtail/wagtail#4254

@aevrisso
Copy link

aevrisso commented Jun 11, 2019

Hi, i used pip install --force-reinstall requests[security] and this as solved my problem, very thanks.
mi version de python es 3.7 64b
django 2.1.7
mis modulos son:
asn1crypto==0.24.0
atomicwrites==1.3.0
attrs==19.1.0
blessings==1.7
certifi==2019.3.9
cffi==1.12.3
chardet==3.0.4
Click==7.0
colorama==0.4.1
config42==0.3.1
coverage==4.5.3
cryptography==2.7
Django==2.1.7
entrypoints==0.3
fake-useragent==0.1.11
filelock==3.0.12
flake8==3.7.7
future==0.17.1
huepy==0.9.8.1
idna==2.8
importlib-metadata==0.17
instabot==0.26.0
instabot-py==0.4.7
instaloader==4.2.8
itsdangerous==1.1.0
mccabe==0.6.1
more-itertools==7.0.0
mysqlclient==1.4.2.post1
Pillow==6.0.0
pluggy==0.12.0
py==1.8.0
pycodestyle==2.5.0
pycparser==2.19
pyflakes==2.1.1
pyOpenSSL==19.0.0
PySocks==1.6.8
pytest==4.5.0
pytest-cov==2.7.1
pytz==2018.9
PyYAML==5.1
requests==2.22.0
requests-toolbelt==0.9.1
responses==0.10.5
schedule==0.6.0
six==1.12.0
SQLAlchemy==1.3.4
toml==0.10.0
tox==3.12.1
tqdm==4.31.1
urllib3==1.25.3
virtualenv==16.4.3
wcwidth==0.1.7
zipp==0.5.1

The lines come out only once and then they do not come out anymore.

@iceman2077
Copy link

I had the same issue.
I solved it by setting DATA_UPLOAD_MAX_NUMBER_FIELDS = 10000 in settings.py
Django 2.2

@Ontheroad123
Copy link

i have the same error,but i solve it .
I have built virtualenv:
python 3.6.0 ,old is 3.6.5
django 2.0.6,old is 2.2

@ssokolow
Copy link

@Ontheroad123 Are you saying that you downgraded Python and Django? ...because that's the worst thing you can do. You're testing against a version that you can't use in production because the whole point of newer versions is to fix known security vulnerabilities.

@Ontheroad123
Copy link

@Ontheroad123 Are you saying that you downgraded Python and Django? ...because that's the worst thing you can do. You're testing against a version that you can't use in production because the whole point of newer versions is to fix known security vulnerabilities.

yes, i downgrades python and django,though i don't know real reason

@harshacheemakurt
Copy link

I had the same issue.
I solved it by setting DATA_UPLOAD_MAX_NUMBER_FIELDS = 10000 in settings.py
Django 2.2

is also not working in Django 2.1.15, still facing the issue

@artur99
Copy link

artur99 commented Apr 13, 2021

django-helpdesk/django-helpdesk#621
Might be related to this, probably fixed with Python 3.7.4+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests