title: how can i get the executable's current directory in py2exe?
body: <p>I use this bit of code in my script to pinpoint, in a cross-platform way, where exactly it's being run from:</p>
  
  <pre><code>SCRIPT_ROOT = os.path.dirname(os.path.realpath(__file__))
  </code></pre>
  
  <p>Pretty simple. I then go on to use <code>SCRIPT_ROOT</code> in other areas of my script to make sure everything is properly relative. My problem occurs when I run it through py2exe, because the generated executable doesn't set <code>__file__</code>, therefore my script breaks. Does anyone know how to fix or work around this?</p>