Description of problem: I specify an inexistant URL (http://abc), for test a script. The command (youtube-dl http://abc) return: Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/bin/youtube-dl/__main__.py", line 17, in <module> File "/usr/bin/youtube-dl/youtube_dl/__init__.py", line 494, in main File "/usr/bin/youtube-dl/youtube_dl/__init__.py", line 478, in _real_main File "/usr/bin/youtube-dl/youtube_dl/FileDownloader.py", line 503, in download File "/usr/bin/youtube-dl/youtube_dl/InfoExtractors.py", line 92, in extract File "/usr/bin/youtube-dl/youtube_dl/InfoExtractors.py", line 1301, in _real_extract File "/usr/bin/youtube-dl/youtube_dl/InfoExtractors.py", line 1290, in _test_redirect File "/usr/lib/python2.7/urllib2.py", line 400, in open response = self._open(req, data) File "/usr/lib/python2.7/urllib2.py", line 418, in _open '_open', req) File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open return self.do_open(httplib.HTTPConnection, req) File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open raise URLError(err) urllib2.URLError: <urlopen error [Errno -2] Name or service not known> Thank's Version-Release number of selected component: youtube-dl-2013.01.13-1.fc18 Additional info: cmdline: python /usr/bin/youtube-dl -x --audio-format vorbis -t http://abc dso_list: python-libs-2.7.3-13.fc18.i686 executable: /usr/bin/youtube-dl kernel: 3.7.9-205.fc18.i686 uid: 1000 Truncated backtrace: urllib2.py:1177:do_open:URLError: <urlopen error [Errno -2] Name or service not known> Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/bin/youtube-dl/__main__.py", line 17, in <module> youtube_dl.main() File "/usr/bin/youtube-dl/youtube_dl/__init__.py", line 494, in main _real_main() File "/usr/bin/youtube-dl/youtube_dl/__init__.py", line 478, in _real_main retcode = fd.download(all_urls) File "/usr/bin/youtube-dl/youtube_dl/FileDownloader.py", line 503, in download videos = ie.extract(url) File "/usr/bin/youtube-dl/youtube_dl/InfoExtractors.py", line 92, in extract return self._real_extract(url) File "/usr/bin/youtube-dl/youtube_dl/InfoExtractors.py", line 1301, in _real_extract if self._test_redirect(url): return File "/usr/bin/youtube-dl/youtube_dl/InfoExtractors.py", line 1290, in _test_redirect response = opener.open(HeadRequest(url)) File "/usr/lib/python2.7/urllib2.py", line 400, in open response = self._open(req, data) File "/usr/lib/python2.7/urllib2.py", line 418, in _open '_open', req) File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 1207, in http_open return self.do_open(httplib.HTTPConnection, req) File "/usr/lib/python2.7/urllib2.py", line 1177, in do_open raise URLError(err) URLError: <urlopen error [Errno -2] Name or service not known> Local variables in innermost frame: err: gaierror(-2, 'Name or service not known') h: <httplib.HTTPConnection instance at 0x9413f0c> self: <urllib2.HTTPHandler instance at 0x93261ac> req: <youtube_dl.InfoExtractors.HeadRequest instance at 0x93261ec> headers: {'Host': 'abc', 'Connection': 'close', 'User-Agent': 'Python-urllib/2.7'} host: 'abc' http_class: <class httplib.HTTPConnection at 0x924f0ec>
Created attachment 704603 [details] File: backtrace
Created attachment 704604 [details] File: core_backtrace
Created attachment 704605 [details] File: environ
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
Hi, Have you tried the newer version? Does it still happen?
Easily reproducible. $ rpm -q youtube-dl youtube-dl-2013.08.02-1.fc19.noarch $ youtube-dl http://abc Traceback (most recent call last): [...] urllib2.URLError: <urlopen error [Errno -2] Name or service not known> $ and ABRT kicks in.
Hi reporter, next time please try a valid URL to play with.
> raise URLError(err) Well, if you're in contact with upstream, typically one would catch such an exception and handle it properly instead of letting the Python program crash. Note that this will return any time another user makes a typo or uses an URL that triggers the same exception.
Hi, thank's for your reply. I report this bug especially for developers, so they treat this exception. It isn't very friendly when, after a typo, the automatic bug reporting tool start.
Exactly. Since I happened to have a github account and believe the youtube-dl developer might be interested in catching such exceptions, I've opened issue #1194 (should catch urllib2.URLError exceptions instead of crashing).