title: Absolute path of .exe file not working properly in python
body: <p>I have simple tkinter desktop app and I recently made a .exe file of it using pyinstaller. However when I want to copy a file it doesn't work because I always get wrong absolute path. Doing the same but running the python script, not the .exe file works fine. When I use relative path it works fine in both .exe and python file. How can I fix it?</p>
  <p>Code:</p>
  <pre><code>def load_map(RL_PATH, map_title):
      PATH = pathlib.Path(__file__).parent.absolute()
      shutil.copyfile(r'{}\Map Files\{}'.format(PATH, map_title),
          r'{}/Labs_Underpass_P.upk'.format(RL_PATH))
  </code></pre>
  <p>Error message I get from the exe file:</p>
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File &quot;tkinter\__init__.py&quot;, line 1883, in __call__
    File &quot;gui.py&quot;, line 154, in &lt;lambda&gt;
      def popular_maps_table(self, map_list):
    File &quot;gui.py&quot;, line 134, in load_map_try
      try:
    File &quot;load_map.py&quot;, line 13, in load_map
      shutil.copyfile(r'{}\Map Files\{}'.format(PATH, map_title),
    File &quot;shutil.py&quot;, line 261, in copyfile
  FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Martin\\AppData\\Local\\Temp\\_MEI132082\\Map Files\\DribblingChallenge2.udk'
  </code></pre>
  <p>It seems like 'C:\Users\Martin\AppData\Local\Temp\_MEI132082' is the absolute path of the exe file.</p>