ConfigParser не выдаёт настройки

Проблема в том что у меня есть 5 параметров и я занёс их в settings.ini и при попытке выдачи строкой (["settings"]["token"]) выдаёт ошибку. Если чекать цифрами выдаёт буквы s e t t i n g s . i n i

config = c.read("settings.ini")["settings"]

for i in range(4):
    print(config[i])

Сам код:

if text == "":
    logger.info("Enter user token for connecting to your account.")
    token = input("Token: ")

    logger.info("Good. Now enter guild id where you want farm some money.")
    guildID = int(input("Guild ID: "))

    logger.info("Good. Now enter channel id where you can send command")
    channelID = int(input("Channel ID: "))

    logger.info("Enter command for work (Default: !work)")
    command = input("Command (Default: !work): ")
    if command == "":
        command = "!work"
        logger.info("Default command")

    logger.info("Enter SECONDS. This is enterval of sending commands.")
    seconds = int(input("Seconds: "))

    c["settings"] = {
    "token": token, # 0
    "guild": guildID, # 1
    "channel": channelID, # 2
    "command": command, # 3
    "interval": seconds # 4
    }
    with open("settings.ini", "w") as w:
        c.write(w)
        #w.close()

    logger.info("Done, restart the bot...")
    input()
    exit(0)
client = Bot(["Catcher", "catcher"], self_bot=True, intents=Intents.all())
config = c.read("settings.ini")["settings"]

for i in range(5):
    print(config[i])

@client.event
async def on_ready():
    logger.info("Bot logged")

    while True:
        channel = None
        #guild = None

        try:
            channel = client.get_guild(int(config[1])).get_channel(int(config[2]))
        except Exception as error:
            logger.fatal("Can't get channel! Log: " + error)
            logger.fatal("Shutdowning! Press ENTER for close.")
            input()
            exit(0)

        await channel.send(str(config[3]))
        time.sleep(int(config[4]))


client.run(str(config[0]), bot=False)

Ответы (1 шт):

Автор решения: ThIsIsTails

config возвращает лист с секциями Надо было использовать изначальную переменную "c"

import configparser
config = configparser.ConfigParser()
config.read("settings.ini")
config["token"]
→ Ссылка