I'm trying to use the PRAW API to host a bot for posting daily Wikipedia threads to /r/Wikipedaily, and I figured I'd use launchd/launchctl to schedule posts to run every 24 hours. The script launches (it's a running launchctl process), but it consistently has status code 78 for some error.
I've tried putting the plist file in both LaunchAgents and LaunchDaemons, launching it with sudo, specifying the path to the Python env in both script and launchd file, and all 3 lead to the same error code. It's not an issue with the Python script itself, I don't think, as running that manually from the command line seems to work fine.
My intuition is that the issue is with the plist file itself, something to do with the Python environment specification, or permissions on files/directories. I gave the Python script permissions via chmod +x, but that might not be sufficient.
This is the plist file (StartInterval set to 60 for debugging purposes rather than 86400, not working regardless):
com.nathansbud.wikipedaily.plist:
<?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>com.nathansbud.wikipedaily</string>
<key>Program</key>
<string>/Users/zackamiton/Code/Wikipedaily/main.py</string>
<key>ProgramArguments</key>
<array>
<string>/Users/zackamiton/Code/Wikipedaily/main.py</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>60</integer>
<key>StandardErrorPath</key>
<string>/var/log/wikipedaily.log</string>
<key>StandardOutPath</key>
<string>/var/log/wikipedaily.log</string>
<key>WorkingDirectory</key>
<string>/Users/zackamiton/Code/Wikipedaily/</string>
</dict>
</plist>
Running it from command line, the Reddit post works just fine, but leaving launchd to execute the script fails with the following error message in the Console:
Service could not initialize: 18C54: xpcproxy + 11287 [1534][EB0A8C9B-6A9A-3296-B905-73527C966685]: 0xd
Service exited with abnormal code: 78
It is running every minute at least (according to console output), but 78 unfortunately seems to be the generic error code which doesn't elucidate much for me, and I'm not sure what to make of the xpcproxy line.
Would appreciate any help with this! Thanks in advance!