Here’s my cron job:
* * * * * python3 /Users/annanguyen/Documents/Anna_Projects/Web_Scraping_Python_projects/Gas_Price_Code.py > /Users/annanguyen/Documents/Anna_Projects/Web_Scraping_Python_projects/Gas_Price_backup_logs/backup.log 2>&1
And here’s the errors I got from my backup log:
Traceback (most recent call last): File "/Users/annanguyen/Documents/Anna_Projects/Web_Scraping_Python_projects/Gas_Price_Code.py", line 1, in <module> import requests ModuleNotFoundError: No module named 'requests'
I checked on Mac Terminal and confirmed that the requests package is already installed here:
Requirement already satisfied: requests in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (2.32.3)
In PyCharm, my Python interpreter has that same exact path as the one above shown in Terminal, and my Python interpreter already has requests package as well. I ran the script manually and it works fine. So I’m not sure what did I do wrong?