Dec-10-2024, 09:34 PM
(This post was last modified: Dec-10-2024, 10:52 PM by CaptainNewb.)
Hi, per my username I'm relatively new to python ;-)
I have a new Mac and when I attempt to run a python script via cron, I receive the following error:
/Library/Developer/CommandLineTools/usr/bin/python3: can't open file '/Users/mi/Downloads/Scripts/TestFile.py': [Errno 1] Operation not permitted
I'm logged in as user mi
The file has the following permissions: -rwxr-xr-x@
When I execute the file manually from the terminal, it runs successfully.
Cronjob is the following:
* * * * * /usr/bin/python3 /Users/mi/Downloads/Scripts/TestFile.py >> ~/Downloads/Scripts/TestFile.log 2>&1
Side Note, when I do run it manually from the terminal, even though it runs successfully, it shows the following message:
/Users/mi/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
I'm not sure if the above message has any impact on the "Operation Not Permitted" issue
When I run "python3 --version" it returns Python 3.9.6
When I run "which python3" it returns /usr/bin/python3
When I run $PATH, it shows the following:
/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/mi/Library/Python/3.9/bin:/Users/mi/Downloads/Scripts:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
Any ideas why it might be working locally but not from the cronjob? Any guidance would be greatly appreciated!
I have a new Mac and when I attempt to run a python script via cron, I receive the following error:
/Library/Developer/CommandLineTools/usr/bin/python3: can't open file '/Users/mi/Downloads/Scripts/TestFile.py': [Errno 1] Operation not permitted
I'm logged in as user mi
The file has the following permissions: -rwxr-xr-x@
When I execute the file manually from the terminal, it runs successfully.
Cronjob is the following:
* * * * * /usr/bin/python3 /Users/mi/Downloads/Scripts/TestFile.py >> ~/Downloads/Scripts/TestFile.log 2>&1
Side Note, when I do run it manually from the terminal, even though it runs successfully, it shows the following message:
/Users/mi/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
I'm not sure if the above message has any impact on the "Operation Not Permitted" issue
When I run "python3 --version" it returns Python 3.9.6
When I run "which python3" it returns /usr/bin/python3
When I run $PATH, it shows the following:
/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/mi/Library/Python/3.9/bin:/Users/mi/Downloads/Scripts:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
Any ideas why it might be working locally but not from the cronjob? Any guidance would be greatly appreciated!