title: capturing stdout from python in an upstart job
body: <p>I'm struggling to save the stdout output of a python2.6 script into a file when I run it as an upstart job.</p>
  
  <p>This is my current test script:</p>
  
  <pre><code>#!/usr/bin/python
  from time import sleep
  import sys
  
  while 1:
      print "Hello from stdout"
      print &gt;&gt; sys.stderr, "Hello from stderr"
      sleep(1)
  </code></pre>
  
  <p>if I do <code>$ myscript &gt;&gt; /var/log/myscript</code> that works fine. I see both.</p>
  
  <p>However, as an upstart script, if I use the following conf</p>
  
  <ol>
  <li><p>/etc/init/myscript.conf: </p>
  
  <pre><code>exec /path/to/myscript &gt;&gt; /var/log/myscript 2&gt;&amp;1
  </code></pre>
  
  <p>I see this:</p>
  
  <pre><code>Hello from stderr
  Hello from stderr
  Hello from stderr
  Hello from stderr
  Hello from stderr
  Hello from stderr
  </code></pre></li>
  </ol>
  
  <p>If I use a different file for stderr and stdout, they are both created, but the stdout is always empty.</p>
  
  <p>What am I doing wrong?</p>