I know this is a common error and it's been asked many times here on SO. I've been through all the solutions and none of them are working for me.
I'm using crontab on my iMac (running Catalina) to set up a cron job:
42 11,20 * * * cd path/to/directory && echo <password> | sudo -S /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 filename.py >> log.txt
The full error I'm getting:
Password:/Library/Frameworks/Python.framework/Versions/3.8/bin/python3: can't open file 'filename.py': [Errno 1] Operation not permitted
I've tried:

Allowing Terminal to have Full Disk Access
Setting permissions on the files in the directory with sudo chown my-username:my-groupname filename
Adding password in the command

but this error never changes.
Any help gratefully accepted.
I was able to resolve this. These are steps you can try to follow:

Open up System Preferences -> Security & Privacy (Mac OSX Catalina)
Open Privacy tab
Click Full Disk Access
Ensure your version of python has been added to the list of application with access.

To do this, just find out where in your system Python is located, navigate there by pasting the path into Finder->Go->Go To Folder, finding the exe file, and dragging it into the Full Disk Access section of Privacy.
Errno 1: Operation not permitted while running cron job in crontab