diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 6e36b22a5..41dc32d7f 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -672,6 +672,10 @@ def _real_main(argv=None): ydl.to_screen(u'--max-download limit reached, aborting.') retcode = 101 + if opts.lastrun: + with open(opts.lastrun, "w") as conf: + conf.write(dateh.today().strftime("%Y%m%d")) + # Dump cookie jar if requested if opts.cookiefile is not None: try: @@ -679,10 +683,6 @@ def _real_main(argv=None): except (IOError, OSError) as err: sys.exit(u'ERROR: unable to save cookie jar') - if opts.lastrun and retcode is 0: - with open(opts.lastrun, "w") as conf: - conf.write(dateh.today().strftime("%Y%m%d")) - sys.exit(retcode) def main(argv=None):