0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-30 03:33:02 +00:00

Fix get_executable_path (#117)

Authored-by: shirtjs <2660574+shirtjs@users.noreply.github.com>
This commit is contained in:
shirt-dev 2021-02-25 17:58:02 -05:00 committed by GitHub
parent 31a5e037a7
commit c552ae8838
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5945,9 +5945,13 @@ def make_dir(path, to_screen=None):
def get_executable_path(): def get_executable_path():
path = os.path.dirname(sys.argv[0]) from zipimport import zipimporter
if os.path.basename(sys.argv[0]) == '__main__': # Running from source if hasattr(sys, 'frozen'): # Running from PyInstaller
path = os.path.join(path, '..') path = os.path.dirname(sys.executable)
elif isinstance(globals().get('__loader__'), zipimporter): # Running from ZIP
path = os.path.join(os.path.dirname(__file__), '../..')
else:
path = os.path.join(os.path.dirname(__file__), '..')
return os.path.abspath(path) return os.path.abspath(path)