事件的Asyncio NotImplementedError

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了事件的Asyncio NotImplementedError相关的知识,希望对你有一定的参考价值。

python 3.8Windows OS 10Django 3.0

我已经从3.6.8升级到python 3.8,但是当我启动django项目时,出现以下错误。通过快速查看踪迹,可以看出扭曲包装中的asyncioreactor文件存在一些问题。此问题的任何解决方案还是已知的错误。

> C:UsersuserDesktopWorkingPy38Current> python manage.py
> runserver 127.0.0.1:8080 Exception in thread django-main-thread:
> Traceback (most recent call last):   File
> "C:UsersuserAppDataLocalProgramsPythonPython38Lib	hreading.py",
> line 932, in _bootstrap_inner
>     self.run()   File "C:UsersuserAppDataLocalProgramsPythonPython38Lib	hreading.py",
> line 870, in run
>     self._target(*self._args, **self._kwargs)   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packagesdjangoutilsautoreload.py",
> line 53, in wrapper  
>     fn(*args, **kwargs)   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packagesdjangocoremanagementcommands
unserver.py",
> line 109, in inner_run
>     autoreload.raise_last_exception()   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packagesdjangoutilsautoreload.py",
> line 76, in raise_last_exception
>     raise _exception[1]   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packagesdjangocoremanagement\__init__.py",
> line 357, in  execute
>     autoreload.check_errors(django.setup)()   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packagesdjangoutilsautoreload.py",
> line 53, in wrapper  
>     fn(*args, **kwargs)   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packagesdjango\__init__.py",
> line 24, in setup
>     apps.populate(settings.INSTALLED_APPS)   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packagesdjangoapps
egistry.py",
> line 91, in populate    
>     app_config = AppConfig.create(entry)   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packagesdjangoappsconfig.py",
> line 116, in create       
>     mod = import_module(mod_path)   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libimportlib\__init__.py",
> line 127, in import_module
>     return _bootstrap._gcd_import(name[level:], package, level)   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import   File
> "<frozen importlib._bootstrap>", line 991, in _find_and_load   File
> "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked 
> File "<frozen importlib._bootstrap>", line 671, in _load_unlocked  
> File "<frozen importlib._bootstrap_external>", line 783, in
> exec_module   File "<frozen importlib._bootstrap>", line 219, in
> _call_with_frames_removed   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packageschannelsapps.py",
> line 6, in <module>
>     import daphne.server   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packagesdaphneserver.py",
> line 18, in <module>
>     asyncioreactor.install()   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packages	wistedinternetasyncioreactor.py",
> line 320, in  install
>     reactor = AsyncioselectorReactor(eventloop)   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packages	wistedinternetasyncioreactor.py",
> line 69, in __init__
>     super().__init__()   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packages	wistedinternetase.py",
> line 571, in __init__  
>     self.installWaker()   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packages	wistedinternetposixbase.py",
> line 286, in installWaker
>     self.addReader(self.waker)   File "C:Usersuser.virtualenvsCurrent-lgPmbAD0libsite-packages	wistedinternetasyncioreactor.py",
> line 151, in  addReader
>     self._asyncioEventloop.add_reader(fd, callWithLogger, reader,   File
> "C:UsersuserAppDataLocalProgramsPythonPython38Libasyncioevents.py",
> line 501, in add_reader
>     raise NotImplementedError
答案

我已经解决了这个问题

AsyncioReactor_Modify

https://github.com/django/channels/issues/969andrewgodwin(The Channels ..)说

您显然正在尝试在Windows下创建UNIX套接字,但该套接字永远无法使用

以上是关于事件的Asyncio NotImplementedError的主要内容,如果未能解决你的问题,请参考以下文章

Asyncio之EventLoop笔记

无法从正在运行的事件循环中调用 asyncio.run()

asyncio事件循环原理

asyncio事件循环原理

corroutine RuntimeError中的Asyncio:没有正在运行的事件循环

asyncio: RuntimeError 这个事件循环已经在运行