diff options
| author | Sergey M․ <dstftw@gmail.com> | 2015-04-16 22:12:38 +0600 | 
|---|---|---|
| committer | Sergey M․ <dstftw@gmail.com> | 2015-04-16 22:12:38 +0600 | 
| commit | be531ef1ec90cb5ee5b3f02d817a140313b76412 (patch) | |
| tree | aa8c5ca951168df62f1aa649ef88ffab1af99487 | |
| parent | 65c1a750f5e5327a2ec8f702509eba05364ca4fa (diff) | |
[utils] Fix splitunc deprecation warning
| -rw-r--r-- | youtube_dl/utils.py | 14 | 
1 files changed, 7 insertions, 7 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 52f0dd09a..e628fac81 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -312,17 +312,17 @@ def sanitize_path(s):      """Sanitizes and normalizes path on Windows"""      if sys.platform != 'win32':          return s -    drive, _ = os.path.splitdrive(s) -    unc, _ = os.path.splitunc(s) -    unc_or_drive = unc or drive -    norm_path = os.path.normpath(remove_start(s, unc_or_drive)).split(os.path.sep) -    if unc_or_drive: +    drive_or_unc, _ = os.path.splitdrive(s) +    if sys.version_info < (2, 7) and not drive_or_unc: +        drive_or_unc, _ = os.path.splitunc(s) +    norm_path = os.path.normpath(remove_start(s, drive_or_unc)).split(os.path.sep) +    if drive_or_unc:          norm_path.pop(0)      sanitized_path = [          path_part if path_part in ['.', '..'] else re.sub('(?:[/<>:"\\|\\\\?\\*]|\.$)', '#', path_part)          for path_part in norm_path] -    if unc_or_drive: -        sanitized_path.insert(0, unc_or_drive + os.path.sep) +    if drive_or_unc: +        sanitized_path.insert(0, drive_or_unc + os.path.sep)      return os.path.join(*sanitized_path)  | 
