Skip to content

Commit

Permalink
Fixed error messages to print file with right extension name
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalguy99 committed Mar 9, 2024
1 parent 64fc0a7 commit 6c788b3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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()
Expand All @@ -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]
Expand Down

0 comments on commit 6c788b3

Please sign in to comment.