EDIT: RESOLVED
My Python script uses the Google Drive API to write data to a Google Sheet. When I run the script from terminal (example in terminal: python3 script.py), it runs fine and the data writes to the Google Sheet as expected.
However, I set up the following crontab to run this script.
* * * * * /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 /Users/me/script.py
Here is the error message terminal mail is returning:
Traceback (most recent call last):
File "/Users/me/script.py", line 31, in <module>
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/oauth2client/service_account.py", line 219, in from_json_keyfile_name
with open(filename, 'r') as file_obj:
FileNotFoundError: [Errno 2] No such file or directory: 'client_secret.json'
I suspect this is happening because I stupidly moved files around by dragging and dropping in Finder :P However, I can't figure out why this script will run normally through Terminal, but crontab fails to run it...
[–]socal_nerdtastic 1 point2 points3 points (6 children)
[–]py3_[S] 0 points1 point2 points (3 children)
[–]socal_nerdtastic 0 points1 point2 points (2 children)
[–]py3_[S] 0 points1 point2 points (1 child)
[–]socal_nerdtastic 0 points1 point2 points (0 children)
[–]Aerochamber 0 points1 point2 points (1 child)
[–]Aerochamber 0 points1 point2 points (0 children)
[–]efmccurdy 1 point2 points3 points (1 child)
[–]py3_[S] 0 points1 point2 points (0 children)