title: Pylons on OS X: proper launchd plist to start and keep alive pylons server?
body: <p><strong>Update: It was simply an import error in the Pylons app (because $PYTHONPATH is different when running a launchd job) that was causing a fail-respawn cycle. Many thanks for those who told me to look at my logs.</strong></p>
  
  <p>Hi all,</p>
  
  <p>I'm on OS X, trying to set up a launchd job to start and keep alive my pylons application.</p>
  
  <p>I load the job as usual:</p>
  
  <pre><code>sudo launchctl unload /Library/LaunchDaemons/dvlf.plist
  </code></pre>
  
  <p>I see no errors in the terminal. The server never comes up. Instead I see this on the console:</p>
  
  <pre><code>4/12/11 6:23:57 PM  com.apple.launchd[1]    (com.dvlf.pylons) Throttling respawn: Will start in 9 seconds
  </code></pre>
  
  <p>Here's the .plist file. Any ideas are greatly appreciated!</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
  &lt;dict&gt;
      &lt;key&gt;Disabled&lt;/key&gt;
      &lt;false/&gt;
      &lt;key&gt;KeepAlive&lt;/key&gt;
      &lt;true/&gt;
      &lt;key&gt;Label&lt;/key&gt;
      &lt;string&gt;com.dvlf.pylons&lt;/string&gt;
      &lt;key&gt;EnvironmentVariables&lt;/key&gt;
          &lt;dict&gt;
                  &lt;key&gt;PYTHON_EGG_CACHE&lt;/key&gt;
                  &lt;string&gt;/tmp/.python-eggs&lt;/string&gt;
          &lt;/dict&gt;
      &lt;key&gt;ProgramArguments&lt;/key&gt;
      &lt;array&gt;
          &lt;string&gt;/usr/local/bin/paster&lt;/string&gt;
          &lt;string&gt;serve&lt;/string&gt;
          &lt;string&gt;--reload&lt;/string&gt;
          &lt;string&gt;/Volumes/w/artfl/projects/dodgr/servers/pylons/DODGR/production.ini&lt;/string&gt;
      &lt;/array&gt;
      &lt;key&gt;RunAtLoad&lt;/key&gt;
      &lt;true/&gt;
      &lt;key&gt;Umask&lt;/key&gt;
      &lt;integer&gt;7&lt;/integer&gt;
      &lt;key&gt;UserName&lt;/key&gt;
      &lt;string&gt;_www&lt;/string&gt;
      &lt;key&gt;WorkingDirectory&lt;/key&gt;
      &lt;string&gt;/Volumes/w/artfl/projects/dodgr/servers/pylons/DODGR/&lt;/string&gt;
      &lt;key&gt;StandardErrorPath&lt;/key&gt;
      &lt;string&gt;/var/log/dvlf_paster_error.log&lt;/string&gt;
      &lt;key&gt;StandardOutPath&lt;/key&gt;
      &lt;string&gt;/var/log/dvlf_output.log&lt;/string&gt;
  &lt;/dict&gt;
  &lt;/plist&gt;
  </code></pre>