mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-14 02:27:42 -07:00
[compat] Use compat_open()
This commit is contained in:
parent
aac33155e4
commit
a25e9f3c84
16 changed files with 68 additions and 55 deletions
|
@ -1,14 +1,16 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import errno
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import traceback
|
||||
|
||||
from .compat import compat_getenv
|
||||
from .compat import (
|
||||
compat_getenv,
|
||||
compat_open as open,
|
||||
)
|
||||
from .utils import (
|
||||
error_to_compat_str,
|
||||
expand_path,
|
||||
|
@ -83,7 +85,7 @@ class Cache(object):
|
|||
cache_fn = self._get_cache_fn(section, key, dtype)
|
||||
try:
|
||||
try:
|
||||
with io.open(cache_fn, 'r', encoding='utf-8') as cachef:
|
||||
with open(cache_fn, 'r', encoding='utf-8') as cachef:
|
||||
return self._validate(json.load(cachef), min_ver)
|
||||
except ValueError:
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue