title: How do I get the path of the Python script I am running in?
body: <blockquote>
    <p><strong>Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/50499/in-python-how-do-i-get-the-path-and-name-of-the-file-that-is-currently-executin">In Python, how do I get the path and name of the file that is currently executing?</a></p>
  </blockquote>
  
  
  
  <p>How do I get the path of a the Python script I am running in? I was doing <code>dirname(sys.argv[0])</code>, however on Mac I only get the filename - not the full path as I do on Windows.</p>
  
  <p>No matter where my application is launched from, I want to open files that are relative to my script file(s).</p>