From f17e49dcf2dbe79893f67dc6a47b8b66a738e32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 6 Aug 2016 13:40:49 +0200 Subject: [PATCH] write error messages to stderr --- gallery_dl/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gallery_dl/__init__.py b/gallery_dl/__init__.py index 56285d1c..4eae50e6 100644 --- a/gallery_dl/__init__.py +++ b/gallery_dl/__init__.py @@ -15,6 +15,7 @@ __maintainer__ = "Mike Fährmann" __email__ = "mike_faehrmann@web.de" import os +import sys import argparse import json from . import config, extractor, job, exception @@ -74,7 +75,7 @@ def parse_option(opt): pass config.set(key.split("."), value) except ValueError: - print("Invalid 'key=value' pair:", opt) + print("Invalid 'key=value' pair:", opt, file=sys.stderr) def main(): try: @@ -113,13 +114,14 @@ def main(): try: jobtype(url).run() except exception.NoExtractorError: - print("No suitable extractor found for URL '", url, "'", sep="") + print("No suitable extractor found for URL '", url, "'", + sep="", file=sys.stderr) except exception.AuthenticationError: print("Authentication failed. Please provide a valid " - "username/password pair.") + "username/password pair.", file=sys.stderr) except KeyboardInterrupt: - print("\nKeyboardInterrupt") + print("\nKeyboardInterrupt", file=sys.stderr) except BrokenPipeError: pass except IOError as e: