Skip to content

Instantly share code, notes, and snippets.

@0x2a94b5
Created July 29, 2020 08:07
Show Gist options
  • Save 0x2a94b5/f6299a0c9c37cf75eebed0c4fd996e31 to your computer and use it in GitHub Desktop.
Save 0x2a94b5/f6299a0c9c37cf75eebed0c4fd996e31 to your computer and use it in GitHub Desktop.
Get the running path of the pyinstaller program.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Get the running path of the pyinstaller program
# Package: pyinstaller -y -F D:\Temp\getExePath.py --add-binary "D:\Temp\dist\tmp.exe;dist/"
# Reference: https://stackoverflow.com/a/44352931
#
import os
import sys
def resource_path(relative_path):
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
return os.path.join(base_path, relative_path)
tmp = resource_path('dist\\tmp.exe')
print(tmp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment