I am beyond confused on why it is not finding the file. Below is the code where the error is. Even though secrets.json is in the same directory as the script I am working on, I get this error: "IOError: [Errno 2] No such file or directory: 'secrets.json'"
Can someone help me on what to change here? I am an amateur coder and will really appreciate the help. Thanks!
I basically want this to open the secrets.json file and pull the key and secret key. I am using Sublime editor.
def get_secret(secret_file):
"""Grabs API key and secret from file and returns them"""
with open(secret_file) as secrets:
secrets_json = json.load(secrets)
secrets.close()
return str(secrets_json['key']), str(secrets_json['secret'])
# setup api
key, secret = get_secret("secrets.json")
api = exchange(key, secret)