Python FileNotFoundError: [Errno 2] No such file or directory
问题 I have the following snippet from a script credentials = ServiceAccountCredentials.from_json_keyfile_name('tok.json', ['https://www.googleapis.com/auth/analytics.readonly']) This is for auth in google analytics But when I run the script on my site, the logs report the following error: FileNotFoundError: [Errno 2] No such file or directory: 'tok.json' I tried putting tok.json in all places (directories?) I can think of on the server, but the error does not disappear 回答1: I had this same error.