Python Telethon第二次停止,出现主要错误

Python Telethon第二次停止,出现主要错误,python,python-asyncio,telegram,telethon,Python,Python Asyncio,Telegram,Telethon,我有这个代码来测试telethon,它运行了一次,我添加了几个通道来测试,第二次运行时,我得到了“name”main“没有定义”,即使我没有更改代码,也只是更改了通道列表中的通道。有人能解释一下并提出建议吗 from telethon.sync import TelegramClient from telethon.tl.functions.channels import JoinChannelRequest from telethon.errors.rpcerrorlist import Fl

我有这个代码来测试telethon,它运行了一次,我添加了几个通道来测试,第二次运行时,我得到了“name”main“没有定义”,即使我没有更改代码,也只是更改了通道列表中的通道。有人能解释一下并提出建议吗

from telethon.sync import TelegramClient
from telethon.tl.functions.channels import JoinChannelRequest
from telethon.errors.rpcerrorlist import FloodWaitError
import time
from dotenv import load_dotenv
import os
import asyncio
channel_list=[
'Realblockways','alaskainu','creampyetoken']

client = TelegramClient('session_name',
2583714,
'myhashpw')

client.start()
for values in channel_list:
    try:
        destination_channel_username=values
        entity=client.get_entity(destination_channel_username)
        client(JoinChannelRequest(channel=values))
        client.send_message(entity=entity,message='testing')

        time.sleep(20)
    except:
        continue
        time.sleep(20)

asyncio.run(main())

代码盲目地忽略所有异常,这可能解释了为什么您没有看到正确的错误。