Ad

Errno 2 No Such File Or Directory: 'credentials.json'

- 1 answer

python 3.6

still in the process of learning python, using this code from a public source but running into this issue:

" [Errno 2] No such file or directory: 'credentials.json' " File "C:\Users\BLINDEYE\Desktop\GeminiBots\main.py",

with open("credentials.json", "r") as f:
    credentials = json.loads(f.read())
CONSUMER_KEY = credentials['CONSUMER_KEY']
CONSUMER_SECRET = credentials['CONSUMER_SECRET']
ACCESS_TOKEN = credentials['ACCESS_TOKEN']
ACCESS_TOKEN_SECRET = credentials['ACCESS_TOKEN_SECRET']

not sure if im just in the wrong directory or what but the requirements.json is stored in C:\Users\BLINDEYE\Desktop\GeminiBots

any help would be appreciated

Ad

Answer

I think littlecute means try this:

 with open("C:/Users/BLINDEYE/Desktop/GeminiBots/credentials.json", "r") as f:
Ad
source: stackoverflow.com
Ad