2

I have a python script in a virtualenv (ENV) that calls on other modules in the ENV. I want to run the script at a certain time each day. Therefore, being on OS X, I should use launchd.

I have written a .plist and put in ~/Library/LaunchAgents for per user use. I have loaded the .plist but am getting an error in my console of the following variety:

14/03/13 10:51:50.000 PM kernel[0]: CODE SIGNING: cs_invalid_page(0x10ce98000): p=1279[python] clearing CS_VALID

I confirmed this message is related to the script, or the launchd process, by setting the .plist key StartInterval to 15 and seeing the message appear every 15 seconds.

Here is the .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.dayone.archive</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/css/Working/PythonScripts/ENV/bin/python</string>
        <string>/Users/css/Working/PythonScripts/ENV/bin/recentLinks.py</string>
    </array>
    <key>StartInterval</key>
    <integer>15</integer>
    <key>KeepAlive</key>
    <true/>
    <key>WorkingDirectory</key>
    <string>/Users/css/Working/PythonScripts/ENV/bin</string>
</dict>
</plist>

I have tried the .plist with a bash script calling the python script as well (!) but got the same result. Of course, I have no problem running the bash script from the terminal.

0

The problem was not with the .plist or with launchd, nor was it with CODE SIGNING as the console error suggested.

Linc Davis over on Apple Communities helped me find the problem: The main python script did NOT call the absolute path of a binary it was calling. Launchd worked beautifully once this was amended. Lesson learned.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.