-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
Closed
Description
Use async on Windows on Python 3.8 will get this error:
ValueError: set_wakeup_fd only works in main threadIt seems a bug in asgiref/mod_wsgi, there is already an issue in asgiref (django/asgiref#143). We may need to fix it upstream before the 2.0 version is out.
Example:
@app.get('/')
async def say_hello():
return {'message': 'Hello!'}Traceback:
Traceback (most recent call last):
File "c:\users\greyli\...\venv\lib\site-packages\flask\app.py", line 1953, in wsgi_app
response = self.full_dispatch_request()
File "c:\users\greyli\...\venv\lib\site-packages\flask\app.py", line 1454, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\users\greyli\...\venv\lib\site-packages\flask\app.py", line 1452, in full_dispatch_request
rv = self.dispatch_request()
File "c:\users\greyli\...\app.py", line 318, in dispatch_request
return self.view_functions[rule.endpoint](*req.view_args.values())
File "c:\users\greyli\...\venv\lib\site-packages\flask\helpers.py", line 781, in outer
return async_to_sync(inner)(*args, **kwargs)
File "c:\users\...\venv\lib\site-packages\asgiref\sync.py", line 203, in __call__
loop_future.result()
File "C:\Users\greyli\.pyenv\pyenv-win\versions\3.8.0\lib\concurrent\futures\_base.py", line 432, in result
return self.__get_result()
File "C:\Users\greyli\.pyenv\pyenv-win\versions\3.8.0\lib\concurrent\futures\_base.py", line 388, in __get_result
raise self._exception
File "C:\Users\greyli\.pyenv\pyenv-win\versions\3.8.0\lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "c:\users\greyli\...\venv\lib\site-packages\asgiref\sync.py", line 256, in _run_event_loop
loop.close()
File "C:\Users\greyli\.pyenv\pyenv-win\versions\3.8.0\lib\asyncio\proactor_events.py", line 679, in
close
signal.set_wakeup_fd(-1)
ValueError: set_wakeup_fd only works in main threadEnvironment:
- OS: Window 10
- Python version: 3.8.0
- Flask version: 2.0.0rc1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels