Why can’t you stop buying 618?From the technical dimension to explore>>>
Questions
In the python 3 environment, when the web returns a file stream (for example, Django returns fileresponse), it will find that the client has not received any return, and the download will prompt a network error
Check the uwsgi log and find that the error is as follows:
io.UnsupportedOperation: fileno
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/django/core/handlers/wsgi.py", line 156, in __call__
response = environ['wsgi.file_wrapper'](response.file_to_stream)
SystemError: <built-in function uwsgi_sendfile> returned a result with an error set
Solution
Method 1
Add the -- WSGI disable file wrapper = true
option to the uwsgi startup configuration, and then restart
https://github.com/unbit/uwsgi/issues/1126
https://uwsgi-docs.readthedocs.io/en/latest/Changelog-2.0.12.html#wsgi -disable-file-wrapper
Method 2
Use other ways to download, such as uploading to alicloud, qiniu, etc., and return to the download address to download
Similar Posts:
- TypeError: ‘unicode’ object is not callable
- TypeError: ‘unicode’ object is not callable
- Strange frame error caused by incorrect use of flash. Redirect (‘/ path’) in flash
- Django startup error: generator expression must be parentized
- [Solved] uwsgi Error: 504 Gateway Time-out
- [Solved] Windows installation uwsgi error: AttributeError: module’os’ has no attribute’uname’
- Python AttributeError: ‘unicode’ object has no attribute ‘tzinfo’
- django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named ‘M…
- [Solved] Django cannot create an app after creating a project
- An error occurs when using PIP install XX command