From 6c788b340f48d821a3d30df87bb03f8f2fccee9b Mon Sep 17 00:00:00 2001 From: digitalguy99 Date: Sun, 10 Mar 2024 02:32:10 +0900 Subject: [PATCH] Fixed error messages to print file with right extension name --- cal.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cal.py b/cal.py index 3ef86d6..a3b0d1e 100644 --- a/cal.py +++ b/cal.py @@ -16,11 +16,11 @@ # Setting variables cal_month, cal_year = None, None -program_version = "4.0.1" +program_version = "4.0.2" if args.month: if len(args.month) > 1: - print(f"{os.path.basename(__file__)}: error: argument -m/--month: too many arguments: 1 expected but given {len(args.month)}") + print(f"{os.path.basename(sys.argv[0])}: error: argument -m/--month: too many arguments: 1 expected but given {len(args.month)}") sys.exit() else: month_string = args.month[0] @@ -33,7 +33,7 @@ except: print( "Enter appropriate month number or 3-letter/full name!", - f"{os.path.basename(__file__)}: error: argument -m/--month: invalid entry: '{month_string}'", + f"{os.path.basename(sys.argv[0])}: error: argument -m/--month: invalid entry: '{month_string}'", sep='\n' ) sys.exit() @@ -42,7 +42,7 @@ if args.year: if len(args.year) > 1: - print(f"{os.path.basename(__file__)}: error: argument -y/--year: too many arguments: 1 expected but given {len(args.year)}") + print(f"{os.path.basename(sys.argv[0])}: error: argument -y/--year: too many arguments: 1 expected but given {len(args.year)}") sys.exit() else: cal_year = args.year[0]