This is my code
import fileinput
import json
with fileinput.input(files=('bot_details.json')) as f:
my_load = json.load(f)
TOKEN=my_load["TOKEN"]
I’m getting this error,
AttributeError: 'FileInput' object has no attribute 'read'
Advertisement
Answer
For a single file use open
with open('bot_details.json') as f:
my_load = json.load(f)
TOKEN=my_load["TOKEN"]