summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-02-02 13:51:54 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-02-02 13:51:54 +0100
commit229cac754aa134d6d14ea7f66904fcc95629c1f1 (patch)
tree593ed10ad676efa3b8b9f4ad57e4855f7eaef339
parent0e33684194c9e364c70e0da3400b9568fa636538 (diff)
downloadyoutube-dl-229cac754aa134d6d14ea7f66904fcc95629c1f1.tar.gz
youtube-dl-229cac754aa134d6d14ea7f66904fcc95629c1f1.tar.xz
youtube-dl-229cac754aa134d6d14ea7f66904fcc95629c1f1.zip
Improve cookie error handling
-rw-r--r--youtube_dl/__init__.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index bdab38a4e..7ed9bfc0d 100644
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -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