GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
1
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
Handbook
Browse code
Fixed filename quotes in error output
master
1 parent
2afc8f6
commit
f1858fdf69e4c417519037a2d594fb81f6f5b1ea
Nigel Stanger
authored
on 22 Jul 2021
Patch
Showing
1 changed file
calendar/teachingdates/app.py
Ignore Space
Show notes
View
calendar/teachingdates/app.py
import argparse import copy import pathlib import sys from jinja2 import TemplateNotFound import teachingdates.calendars as calendars import teachingdates.config as configuration from teachingdates import PROG def run(): args = configuration.parse_command_line() if args.debug: print("{prog}: debug: args: {a}".format(prog=PROG, a=args)) try: dates_config = configuration.Configuration(args) if args.debug: print("{prog}: debug: period config: {c}".format( prog=PROG, c=dates_config.get_period_config())) print("{prog}: debug: paper config: {c}".format( prog=PROG, c=dates_config.get_paper_config())) cal = calendars.TeachingCalendar(dates_config) if args.debug: print("Calendar: {cal}".format(cal=cal.calendar())) print("Lectures: {lec}".format(lec=cal.lecture_dates())) print(cal.render(args.style, args.format)) except configuration.ConfigurationError as e: print("{prog}: error: failed to load configuration from " "{file}".format(prog=PROG, file=e)) except configuration.PaperKeyError as e: print("{prog}: error: paper '{paper}' in {file} is missing " "required key '{key}'".format(prog=PROG, paper=e.parent, file=e.file, key=e.key)) except configuration.PeriodKeyError as e: print("{prog}: error: teaching period '{period}' in {file} is " "missing required key '{key}'".format(prog=PROG, period=e.parent, file=e.file, key=e.key)) except configuration.PaperError as e: print("{prog}: error: no entry for paper '{paper}' ({period}) in " "{file}.".format(prog=PROG, file=e, paper=args.paper, period=args.period)) except configuration.PeriodError as e: print("{prog}: error: no entry for teaching period '{period}' in " "{file}".format(prog=PROG, file=e, period=args.period)) except TemplateNotFound as e: print("{prog}: error: no template found for output style '{style}' " "and output format '{format}' (expected {file})".format( prog=PROG, style=args.style, format=args.format, file=e))
import argparse import copy import pathlib import sys from jinja2 import TemplateNotFound import teachingdates.calendars as calendars import teachingdates.config as configuration from teachingdates import PROG def run(): args = configuration.parse_command_line() if args.debug: print("{prog}: debug: args: {a}".format(prog=PROG, a=args)) try: dates_config = configuration.Configuration(args) if args.debug: print("{prog}: debug: period config: {c}".format( prog=PROG, c=dates_config.get_period_config())) print("{prog}: debug: paper config: {c}".format( prog=PROG, c=dates_config.get_paper_config())) cal = calendars.TeachingCalendar(dates_config) if args.debug: print("Calendar: {cal}".format(cal=cal.calendar())) print("Lectures: {lec}".format(lec=cal.lecture_dates())) print(cal.render(args.style, args.format)) except configuration.ConfigurationError as e: print("{prog}: error: failed to load configuration from " "'{file}'".format(prog=PROG, file=e)) except configuration.PaperKeyError as e: print("{prog}: error: paper '{paper}' in '{file}' is missing " "required key '{key}'".format(prog=PROG, paper=e.parent, file=e.file, key=e.key)) except configuration.PeriodKeyError as e: print("{prog}: error: teaching period '{period}' in '{file}' is " "missing required key '{key}'".format(prog=PROG, period=e.parent, file=e.file, key=e.key)) except configuration.PaperError as e: print("{prog}: error: no entry for paper '{paper}' ({period}) in " "'{file}.'".format(prog=PROG, file=e, paper=args.paper, period=args.period)) except configuration.PeriodError as e: print("{prog}: error: no entry for teaching period '{period}' in " "'{file}'".format(prog=PROG, file=e, period=args.period)) except TemplateNotFound as e: print("{prog}: error: no template found for output style '{style}' " "and output format '{format}' (expected '{file}')".format( prog=PROG, style=args.style, format=args.format, file=e))
Show line notes below