如果__name__ == "__main__":失败;为什么__main__不打电话给我的课程?



我一直在简化这段代码,我没有文字。简单地说,该文件不会运行以调用当前的类,并扩展其中的函数。这个错误是我从来没有遇到过的,如果有人能提供的话,请澄清一下。

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 ----anaconda3libsite-packagesspyder_kernelscommsfrontendcomm.py", line 164, in poll_one
asyncio.run(handler(out_stream, ident, msg))
File "C:Users ----anaconda3libsite-packagesnest_asyncio.py", line 33, in run
task = asyncio.ensure_future(main)
File "C:Users ----anaconda3libasynciotasks.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):

无限期重复

Spyder5.2.0修复此错误(2021年11月上映)。请按照此处发布的说明更新到最新版本。

相关内容

最新更新