-1

im trying to create a config file but it keeps giving me an error

Traceback (most recent call last):
  File "c:\Users\Bryan\Documents\Bots\ArqadeBotService\main.py", line 15, in <module>
    config = json.load(file)
             ^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
           ^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

this is the code im using

import discord
from discord.ext import commands
import json
from colorama import Back, Fore, Style
import time
import platform



def load_config():
    with open("config.json", "r") as file:
        return json.load(file)

config  = load_config()

# rest of the code

client.run(config["token"])

and here is the config.json file

{
    "bot_info": [
        {
            "prefix": ".",
            "token": "MTE0NDMyMzM5NjAzODA0MTcxMw.G4NGDH.rDfsUei-6Ua0pg4aFVQFqVjBX-hWfoLETZjRGg"
        }
    ]
}

i tried multiple ways of getting the config file ut i gives me the same error

-EDIT

i found out that the actual config file is empty. It only shows the code in config whe i open it in vsc.so this is prob why the error shows up bu i dont know why the file is empty

Arqade
  • 9
  • 4

0 Answers0