mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 23:26:53 +01:00
Py2 compatibility for FileNotFoundError
This commit is contained in:
parent
6b1d8c1e30
commit
88728713c8
@ -1,5 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import errno
|
||||||
try:
|
try:
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
can_threaded_download = True
|
can_threaded_download = True
|
||||||
@ -126,7 +127,10 @@ def append_fragment(frag_content, frag_index):
|
|||||||
file.close()
|
file.close()
|
||||||
self._append_fragment(ctx, frag_content)
|
self._append_fragment(ctx, frag_content)
|
||||||
return True
|
return True
|
||||||
except FileNotFoundError:
|
except EnvironmentError as ose:
|
||||||
|
if ose.errno != errno.ENOENT:
|
||||||
|
raise
|
||||||
|
# FileNotFoundError
|
||||||
if skip_unavailable_fragments:
|
if skip_unavailable_fragments:
|
||||||
self.report_skip_fragment(frag_index)
|
self.report_skip_fragment(frag_index)
|
||||||
return True
|
return True
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import errno
|
||||||
import re
|
import re
|
||||||
import binascii
|
import binascii
|
||||||
try:
|
try:
|
||||||
@ -316,7 +317,10 @@ def append_fragment(frag_content, frag_index):
|
|||||||
file.close()
|
file.close()
|
||||||
self._append_fragment(ctx, frag_content)
|
self._append_fragment(ctx, frag_content)
|
||||||
return True
|
return True
|
||||||
except FileNotFoundError:
|
except EnvironmentError as ose:
|
||||||
|
if ose.errno != errno.ENOENT:
|
||||||
|
raise
|
||||||
|
# FileNotFoundError
|
||||||
if skip_unavailable_fragments:
|
if skip_unavailable_fragments:
|
||||||
self.report_skip_fragment(frag_index)
|
self.report_skip_fragment(frag_index)
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user