title: Pyinstaller compiled binary runs from %temp% folder
body: <p>I am using <code>sys.path[0]</code> in my script to detect the folder my script resides in. I have no issues running the executing the .py file.</p>
  
  <p>I then compile the script using pyinstaller and run it, it fails. I noticed that when exe runs, the <code>sys.path[0]</code> changes to %temp%. Looks like exe runs from %temp% directory. However, in another place I reference <code>sys.argv[1]</code> which does not change.</p>
  
  <p>For example, I see the following when exe runs:</p>
  
  <p><code>sys.path[0] -&gt; C:\\Users\\&lt;username&gt;\\AppData\\Local\Temp\&lt;temp folder&gt;</code></p>
  
  <p><code>sys.argv[1] -&gt; C:\path\where\exe resides</code></p>