From 9a976853f6953b42c3f78cf989e028522bc48772 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 23 Oct 2014 16:25:31 +0200 Subject: * printing -v info to stderr --- elo.py | 2 +- f1elo/interface.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/elo.py b/elo.py index 4fac540..7f88113 100755 --- a/elo.py +++ b/elo.py @@ -19,7 +19,7 @@ parser.add_argument('--date', 'reset ratings all the way down to DATE\n' 'or rank the races all the way up to DATE.') parser.add_argument('--limit', help='Ranking list (display) cut-off point.', type=int) -parser.add_argument('-v', help='Display verbose info on rating progress.', action='store_true') +parser.add_argument('-v', help='Display verbose info on rating progress to STDERR.', action='store_true') parser.add_argument('--force', '-f', help='Force database initialization (for "init" command).', action='store_true') arguments = parser.parse_args() diff --git a/f1elo/interface.py b/f1elo/interface.py index 4b938ae..a077986 100644 --- a/f1elo/interface.py +++ b/f1elo/interface.py @@ -1,5 +1,8 @@ +from __future__ import print_function + import datetime import dateutil.relativedelta +import sys from sqlalchemy import MetaData @@ -28,7 +31,7 @@ class Interface: for race in query.all(): race.ranked = False if _debug: - print race + print(race, file=sys.stderr) query = self.session.query(Ranking) if date is not None: @@ -56,8 +59,8 @@ class Interface: for race in races: if _debug: - print race - print + print(race, file=sys.stderr) + print('', file=sys.stderr) ranks = elo.rank_race(race) driver_ranks = {} @@ -76,8 +79,8 @@ class Interface: if _debug: for entry in race.entries: - print entry, elo.get_entry_ranking(entry, race.date), elo.get_entry_ranking(entry) - print + print(entry, elo.get_entry_ranking(entry, race.date), elo.get_entry_ranking(entry), file=sys.stderr) + print('', file=sys.stderr) race.ranked = True date = race.date -- cgit v1.2.3