title: lsof command doesn't look in specified directory when i specify user
body: <p>So I was writing a python script and my goal was to use lsof to list all open files under a specific directory (my home folder) for the local user and only output the 'uniq' entries.</p>
  
  <p>My script looked like this:</p>
  
  <pre><code>import os, sys, getpass
  user = getpass.getuser()
  cmd = "lsof -u " + user + " +d ~ | sort | uniq"
  os.system(cmd)
  </code></pre>
  
  <p>This kind of does what I want it to do, it does lsof for the current local user, but it fails to look specifically in the home directory that i specified.  Instead it does lsof on the root directory and lists all lsof for the entire file system for the user.  However, when I do the same command without the <code>-u user</code> it looks specifically in the home directory.  I've been looking into why this is exactly, and yes I have tried using <code>+d /home/</code> and <code>+d ~/home/</code> instead of just <code>+d ~</code> to get this to work with no success, so I am kind of stumped.  Any advice would be great :)</p>