diff --git a/yt_dlp/__main__.py b/yt_dlp/__main__.py index 06c392039..70bc52323 100644 --- a/yt_dlp/__main__.py +++ b/yt_dlp/__main__.py @@ -4,14 +4,15 @@ # $ python3 -m yt_dlp import sys +from pathlib import Path if __package__ is None and not getattr(sys, 'frozen', False): # direct call of __main__.py - import os.path - path = os.path.realpath(os.path.abspath(__file__)) - sys.path.insert(0, os.path.dirname(os.path.dirname(path))) + path = Path(__file__).resolve() + sys.path.insert(0, str(path.parent.parent)) import yt_dlp if __name__ == '__main__': + yt_dlp.main()