title: python location of the running program on windows
body: <p>I have an python application that need to know in which directory it founded when it run,</p>
  
  <p>how can i know the running application path on windows for example when i change the directory path is changed to the new directory .</p>
  
  <p>is there a way to know where is the python application run withour saving it on the beginning by os.path.abspath(os.path.dirname(<strong>file</strong>))</p>
  
  <p>for example the to know where the application runs after os.chdir("c:/")</p>
  
  <pre><code>     import os 
       print os.path.abspath(os.path.dirname(__file__))
       os.chdir("c:/")
       print os.path.abspath(os.path.dirname(__file__))
  </code></pre>