From 4467e66adb26be6409c68e7ff5408776b224170a Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 2 Feb 2014 17:07:35 +0400 Subject: [PATCH] Fix a bug: option -o without any parameters --- mimedecode.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 = '-' -- 2.39.5