title: Find a program directory from within after turning to .exe using py2exe
body: <p>I am writing a code which I want to have details to its own directory. e.g. C:\Users\User\Desktop\helloworld.py</p>
  
  <p>Is there a way to find it from within the program using pywin32 or any other module?</p>
  
  <p>If so, once I turn it into .exe using py2exe will it still be able to find it's own directory(C:\Users\User\Desktop\dist\helloworld.exe)</p>
  
  <p>I tried the following code:</p>
  
  <pre><code>print os.path.dirname(os.path.realpath(sys.argv[0]))
  </code></pre>
  
  <p>This works but once I turn it into a .exe file it doesn't manage to run.... What other solutions can there be?
  The error I get in the log file is the following error:
  <strong>Traceback (most recent call last): File "finddirectory.py", line 4, in  EOFError: EOF when reading a line</strong></p>