I m 在Aiogram上写了一把机器人。 我根据文件做了一切,但我有了一个错误。 我第一次看到她。 请帮助我解决问题
def on_startup(bot: Bot) -> None:
asyncio.create_task(start_schedule(bot))
async def start_schedule(botself):
aioschedule.every().day.at( 00:00 ).do(lottery.lottery_finish, botself)
while True:
await aioschedule.run_pending()
await asyncio.sleep(1)
async def main():
bot = Bot(token=BOT_TOKEN, parse_mode= html )
dp = Dispatcher()
dp.startup.register(on_startup)
dp.include_routers(main_menu.router, order.router, report.router, phone.router, location.router, receipt_scan.router, admin_panel.router, lottery_panel.router, products_panel.router, post_panel.router, markets_panel.router, early_close_panel.router, code.router, pre_admin_panel.router, availability_panel.router)
await bot.delete_webhook(drop_pending_updates=True)
await dp.start_polling(bot)
if __name__ == __main__ :
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
asyncio.run(main())
error in text format:
Traceback (most recent call last):
File "C:UsersDTEAAPycharmProjectschester_users2ot.py", line 44, in <module>
asyncio.run(main())
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasyncio
unners.py", line 44, in run
return loop.run_until_complete(main)
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasyncioase_events.py", line 642, in run_until_complete
return future.result()
File "C:UsersDTEAAPycharmProjectschester_users2ot.py", line 39, in main
await dp.start_polling(bot)
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libsite-packagesaiogramdispatcherdispatcher.py", line 526, in start_polling
await self.emit_startup(bot=bots[-1], **workflow_data)
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libsite-packagesaiogramdispatcher
outer.py", line 230, in emit_startup
await self.startup.trigger(*args, **kwargs)
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libsite-packagesaiogramdispatchereventevent.py", line 42, in trigger
await handler.call(*args, **kwargs)
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libsite-packagesaiogramdispatchereventhandler.py", line 48, in call
return await loop.run_in_executor(None, wrapped)
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libconcurrentfutures hread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "C:UsersDTEAAPycharmProjectschester_users2ot.py", line 18, in on_startup
asyncio.create_task(start_schedule(bot))
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasyncio asks.py", line 360, in create_task
loop = events.get_running_loop()
RuntimeError: no running event loop
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x00000224FFE334C0>
ERROR:asyncio:Unclosed connector
connections: [ [(<aiohttp.client_proto.ResponseHandler object at 0x00000224FFE133A0>, 6128.968)] ]
connector: <aiohttp.connector.TCPConnector object at 0x00000224FFE33340>
ERROR:asyncio:Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x00000224FFE33970>
transport: <_ProactorSocketTransport fd=596 read=<_OverlappedFuture cancelled>>
Traceback (most recent call last):
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasynciosslproto.py", line 684, in _process_write_backlog
self._transport.write(chunk)
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasyncioproactor_events.py", line 359, in write
self._loop_writing(data=bytes(data))
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasyncioproactor_events.py", line 395, in _loop_writing
self._write_fut = self._loop._proactor.send(self._sock, data)
AttributeError: NoneType object has no attribute send
sys:1: RuntimeWarning: coroutine start_schedule was never awaited
Exception ignored in: <function _SSLProtocolTransport.__del__ at 0x00000224EFC60D30>
Traceback (most recent call last):
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasynciosslproto.py", line 321, in __del__
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasynciosslproto.py", line 316, in close
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasynciosslproto.py", line 593, in _start_shutdown
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasynciosslproto.py", line 598, in _write_appdata
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasynciosslproto.py", line 706, in _process_write_backlog
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasynciosslproto.py", line 720, in _fatal_error
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasyncioproactor_events.py", line 151, in _force_close
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasyncioase_events.py", line 746, in call_soon
File "C:UsersDTEAAAppDataLocalProgramsPythonPython39libasyncioase_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed
Process finished with exit code 1
StackOverflow asks for more characters because there is a lot of code in the question. don t pay attention to this text