Python MessageLoop(bot,handle)。永远运行(';我不在工作

Python MessageLoop(bot,handle)。永远运行(';我不在工作,python,telegram,telepot,Python,Telegram,Telepot,我在cmd和Pycharm中都尝试了下面的代码。它在cmd中运行得很好,但在Pycharm中运行得不好。我无法获得任何更新,整个过程刚刚完成。我能知道怎么解决这个问题吗? PS:当我将run_as_线程更改为run_forever()时,它在Pycharm中起作用 在此之后,您必须添加一个While循环,以保持程序阻塞 像- MessageLoop(bot, handle).run_as_thread() print ('Listening....') while 1: sleep(10

我在cmd和Pycharm中都尝试了下面的代码。它在cmd中运行得很好,但在Pycharm中运行得不好。我无法获得任何更新,整个过程刚刚完成。我能知道怎么解决这个问题吗? PS:当我将run_as_线程更改为run_forever()时,它在Pycharm中起作用


在此之后,您必须添加一个While循环,以保持程序阻塞

像-

MessageLoop(bot, handle).run_as_thread()
print ('Listening....')
while 1:
    sleep(10)
或者让它永远运行,它会自动阻止

MessageLoop(bot, handle).run_forever()
MessageLoop(bot, handle).run_forever()