From: Oleg Broytman Date: Sun, 2 Feb 2014 13:07:35 +0000 (+0400) Subject: Fix a bug: option -o without any parameters X-Git-Tag: v2.3.3~1 X-Git-Url: https://git.phdru.name/?p=mimedecode.git;a=commitdiff_plain;h=4467e66adb26be6409c68e7ff5408776b224170a Fix a bug: option -o without any parameters --- diff --git a/mimedecode.py b/mimedecode.py index 9aab1b3..b6f139b 100755 --- a/mimedecode.py +++ b/mimedecode.py @@ -350,9 +350,12 @@ if __name__ == "__main__": la = len(arguments) if la == 0: gopts.input_filename = '-' - gopts.output_filename = '-' infile = sys.stdin - outfile = sys.stdout + if gopts.output_filename: + outfile = open(gopts.output_filename, 'w') + else: + gopts.output_filename = '-' + outfile = sys.stdout elif la in (1, 2): if (arguments[0] == '-'): gopts.input_filename = '-'