[openload] Remove a confusing exception
If phantomjs is not installed, there's an error besides the missing phantomjs exception: Exception ignored in: <bound method PhantomJSwrapper.__del__ of <youtube_dl.extractor.openload.PhantomJSwrapper object at 0x7f8ad5e78278>> Traceback (most recent call last): File "/home/yen/Projects/youtube-dl/youtube_dl/extractor/openload.py", line 142, in __del__ os.remove(self._TMP_FILES[name].name) AttributeError: 'PhantomJSwrapper' object has no attribute '_TMP_FILES'master
parent
273c23d960
commit
a75419586b
|
@ -112,6 +112,8 @@ class PhantomJSwrapper(object):
|
||||||
return get_exe_version('phantomjs', version_re=r'([0-9.]+)')
|
return get_exe_version('phantomjs', version_re=r'([0-9.]+)')
|
||||||
|
|
||||||
def __init__(self, extractor, required_version=None, timeout=10000):
|
def __init__(self, extractor, required_version=None, timeout=10000):
|
||||||
|
self._TMP_FILES = {}
|
||||||
|
|
||||||
self.exe = check_executable('phantomjs', ['-v'])
|
self.exe = check_executable('phantomjs', ['-v'])
|
||||||
if not self.exe:
|
if not self.exe:
|
||||||
raise ExtractorError('PhantomJS executable not found in PATH, '
|
raise ExtractorError('PhantomJS executable not found in PATH, '
|
||||||
|
@ -130,7 +132,6 @@ class PhantomJSwrapper(object):
|
||||||
self.options = {
|
self.options = {
|
||||||
'timeout': timeout,
|
'timeout': timeout,
|
||||||
}
|
}
|
||||||
self._TMP_FILES = {}
|
|
||||||
for name in self._TMP_FILE_NAMES:
|
for name in self._TMP_FILE_NAMES:
|
||||||
tmp = tempfile.NamedTemporaryFile(delete=False)
|
tmp = tempfile.NamedTemporaryFile(delete=False)
|
||||||
tmp.close()
|
tmp.close()
|
||||||
|
@ -140,7 +141,7 @@ class PhantomJSwrapper(object):
|
||||||
for name in self._TMP_FILE_NAMES:
|
for name in self._TMP_FILE_NAMES:
|
||||||
try:
|
try:
|
||||||
os.remove(self._TMP_FILES[name].name)
|
os.remove(self._TMP_FILES[name].name)
|
||||||
except (IOError, OSError):
|
except (IOError, OSError, KeyError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _save_cookies(self, url):
|
def _save_cookies(self, url):
|
||||||
|
|
Loading…
Reference in New Issue