]> git.bitcoin.ninja Git - youtube-dl/commitdiff
Improve cookie error handling
authorPhilipp Hagemeister <phihag@phihag.de>
Sat, 2 Feb 2013 12:51:54 +0000 (13:51 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Sat, 2 Feb 2013 12:51:54 +0000 (13:51 +0100)
youtube_dl/__init__.py

index bdab38a4ef699bfe8993f89adb16807a1a9de61f..7ed9bfc0df830f4e5124a59f242cac3c267178c8 100644 (file)
@@ -290,10 +290,13 @@ def _real_main():
     else:
         try:
             jar = compat_cookiejar.MozillaCookieJar(opts.cookiefile)
-            if os.path.isfile(opts.cookiefile) and os.access(opts.cookiefile, os.R_OK):
+            if os.access(opts.cookiefile, os.R_OK):
                 jar.load()
         except (IOError, OSError) as err:
-            sys.exit(u'ERROR: unable to open cookie file')
+            if opts.verbose:
+                traceback.print_exc()
+            sys.stderr.write(u'ERROR: unable to open cookie file\n')
+            sys.exit(101)
     # Set user agent
     if opts.user_agent is not None:
         std_headers['User-Agent'] = opts.user_agent