0

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'

1 Answer 1

1

For a single file use open

with open('bot_details.json') as f:
    my_load = json.load(f)
    TOKEN=my_load["TOKEN"]
Sign up to request clarification or add additional context in comments.

1 Comment

Yeah I made a mistake, check again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.