title: Paster daemon won't shut down because can't read own pid file
body: <p><strong>TL;DR version</strong>: When I ask Paster to stop-daemon, it fails to read its own file that it uses to track its process id.</p>
  
  <p><strong>Longer version</strong>:</p>
  
  <p>I am running Paster (pastescript 1.7.3) on Python 2.7.1 on Windows Vista.</p>
  
  <p>My first surprise comes from running a simple web-site:</p>
  
  <pre><code>&gt;paster serve development.ini
  Starting server in PID 15184.
  serving on http://127.0.0.1:5000
  </code></pre>
  
  <p>I expected to find a paster.pid file in the same directory, but I don't. Odd. Never mind, let's make it explicit, by killing that process and starting again.</p>
  
  <pre><code>&gt;paster serve development.ini --pid-file=my.pid
  Starting server in PID 20884.
  serving on http://127.0.0.1:5000
  </code></pre>
  
  <p>This time, it creates a file called my.pid. In another command window, I can type:</p>
  
  <pre><code> &gt;type my.pid
   20884
  </code></pre>
  
  <p>The web-site is being served successfully and Task Manager confirms there is a python process running with PID 20884.</p>
  
  <p>Now, let's ask paster to report on the status of the daemon:</p>
  
  <pre><code>&gt;paster serve development.ini --status --pid-file=my.pid
  PID None in my.pid is not running
  
  &gt;type my.pid
  20884
  </code></pre>
  
  <p>Odd. It claims the the PID inside my.pid is <code>None</code>, when it isn't.</p>
  
  <p>Let's shut it down.</p>
  
  <pre><code>&gt;paster serve --stop-daemon --pid-file=my.pid
  PID in my.pid is not valid (deleting)
  
  &gt;type my.pid
  The system cannot find the file specified.
  </code></pre>
  
  <p>So, it tried to read my.pid, couldn't read it, and deleted it in frustration.</p>
  
  <p>Meanwhile the daemon continues to run.</p>
  
  <p>I have to kill the paster daemon by hand, which is what @Lennart Regebro recommends in a <a href="https://stackoverflow.com/questions/1502568/paster-cannot-stop-daemon">similar, less detailed question</a>. 
  I want to automate this as part of my testing, so I am hoping to find a cleaner solution.</p>
  
  <p>Any suggestions?</p>