summaryrefslogtreecommitdiff
path: root/bidding_data.py
diff options
context:
space:
mode:
Diffstat (limited to 'bidding_data.py')
-rw-r--r--bidding_data.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/bidding_data.py b/bidding_data.py
index a56847b..e24ffba 100644
--- a/bidding_data.py
+++ b/bidding_data.py
@@ -156,7 +156,7 @@ class JFRBidding:
self.__round_lineups = self.__parse_lineup_data(self.__lineup_data)
self.__bids = self.__parse_bidding_data(bid_data)
self.__tournament_prefix = path.splitext(
- path.realpath(file_prefix + '.html'))[0]
+ path.realpath(file_prefix))[0]
self.__tournament_files_match = re.compile(
re.escape(self.__tournament_prefix) + '([0-9]{3})\.html')
self.__map_board_numbers()
@@ -276,10 +276,20 @@ if __name__ == '__main__':
argument_parser = argparse.ArgumentParser(
description='Display bidding data from BWS files on JFR Pary pages')
+
+ def file_path(filepath):
+ filepath = unicode(filepath, sys.getfilesystemencoding())
+ if path.isfile(filepath):
+ return filepath
+ else:
+ argument_parser.error('File %s does not exist' % filepath)
+
argument_parser.add_argument('bws_file', metavar='BWS_FILE',
- help='path to BWS file')
+ help='path to BWS file',
+ type=file_path)
argument_parser.add_argument('path', metavar='PATH',
- help='tournament path with JFR prefix')
+ help='tournament path (to PREFIX.html)',
+ type=file_path)
arguments = argument_parser.parse_args()