'My simple Launchd plist is not running my python script (file runs OK from CMD line)

This might be a very basic question, as I am new to this... any help would be really helpful

I have a python script that runs no problem from the CMD line as follows:

cd /Users/johnEd/Documents/code/myFolder && python3 myfile.py

I want to use launchd to run the script daily on my Mac, but I cannot even manage to get it to run properly. This is the plist I am using:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>launchd.test</string>
    <key>ProgramArguments</key>
    <array>
        <string>sh</string>
        <string>-c</string>
        <string>cd /Users/johnEd/Documents/code/myFolder &amp;&amp;  python3 myfile.py</string>
    </array>
</dict>
</plist>

The plist is loading properly, but it is not starting the job at all. Does anybody know what am I doing wrong?

thanks!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source