diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py index 062b338d73d8..d1b86bd13df4 100644 --- a/youtube_dl/compat.py +++ b/youtube_dl/compat.py @@ -3009,6 +3009,7 @@ def compat_ctypes_WINFUNCTYPE(*args, **kwargs): 'compat_os_name', 'compat_parse_qs', 'compat_print', + 'compat_realpath', 'compat_setenv', 'compat_shlex_quote', 'compat_shlex_split', diff --git a/youtube_dl/update.py b/youtube_dl/update.py index 002ea7f33862..84c9646171e0 100644 --- a/youtube_dl/update.py +++ b/youtube_dl/update.py @@ -9,6 +9,7 @@ import sys from zipimport import zipimporter +from .compat import compat_realpath from .utils import encode_compat_str from .version import __version__ @@ -84,7 +85,9 @@ def version_tuple(version_str): print_notes(to_screen, versions_info['versions']) # sys.executable is set to the full pathname of the exe-file for py2exe - filename = sys.executable if hasattr(sys, 'frozen') else sys.argv[0] + # though symlinks are not followed so that we need to do this manually + # with help of realpath + filename = compat_realpath(sys.executable if hasattr(sys, 'frozen') else sys.argv[0]) if not os.access(filename, os.W_OK): to_screen('ERROR: no write permissions on %s' % filename)