如果__name__ ==; __ Main __&quot“:失败;为什么会赢得我的课程,__________________________________________________________
我一直在简化此代码,但我没有言语。简而言之,该文件不会运行以调用存在的类,也不会扩展其中的功能。这个错误是我从未遇到的事情,并且希望有人能提供一些清晰度。
class Server_Design:
def __init__(self):
self.intro_input()
def intro_input(self):
self.host = input('Host: ')
self.port = input('Port: ')
print("y")
if __name__ == "__main__":
Server_Design()
命令行输出:
[SpyderKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "C:\Users\ ----\anaconda3\lib\site-packages\spyder_kernels\comms\frontendcomm.py", line 164, in poll_one
asyncio.run(handler(out_stream, ident, msg))
File "C:\Users\ ----\anaconda3\lib\site-packages\nest_asyncio.py", line 33, in run
task = asyncio.ensure_future(main)
File "C:\Users\ ----\anaconda3\lib\asyncio\tasks.py", line 677, in ensure_future
raise TypeError('An asyncio.Future, a coroutine or an awaitable is '
TypeError: An asyncio.Future, a coroutine or an awaitable is required
[SpyderKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
无限期重复
I have been simplifying this code and I am without words. Simply put, the file will not run to call the classes present, and by extension the functions within. The error is something I have never come across and would like some clarity on, if someone could provide it, please.
class Server_Design:
def __init__(self):
self.intro_input()
def intro_input(self):
self.host = input('Host: ')
self.port = input('Port: ')
print("y")
if __name__ == "__main__":
Server_Design()
COMMAND LINE OUTPUT:
[SpyderKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "C:\Users\ ----\anaconda3\lib\site-packages\spyder_kernels\comms\frontendcomm.py", line 164, in poll_one
asyncio.run(handler(out_stream, ident, msg))
File "C:\Users\ ----\anaconda3\lib\site-packages\nest_asyncio.py", line 33, in run
task = asyncio.ensure_future(main)
File "C:\Users\ ----\anaconda3\lib\asyncio\tasks.py", line 677, in ensure_future
raise TypeError('An asyncio.Future, a coroutine or an awaitable is '
TypeError: An asyncio.Future, a coroutine or an awaitable is required
[SpyderKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
repeating indefinitely
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Spyder 5.2.0 (于2021年11月发布)中固定了此误差。请按照发布的说明在这里。
This error was fixed in Spyder 5.2.0 (released on November 2021). Please update to a more recent version by following the instructions posted here.