Created
July 29, 2020 08:07
-
-
Save 0x2a94b5/f6299a0c9c37cf75eebed0c4fd996e31 to your computer and use it in GitHub Desktop.
Get the running path of the pyinstaller program.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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