From f871a904201eaf645faa159ead720975818f0a69 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 7 Oct 2018 00:07:50 +0200 Subject: util: add another path to search for fortunes --- kpov_judge/kpov_util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'kpov_judge') diff --git a/kpov_judge/kpov_util.py b/kpov_judge/kpov_util.py index 491e7ce..74b1737 100755 --- a/kpov_judge/kpov_util.py +++ b/kpov_judge/kpov_util.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import itertools import random import string import socket @@ -19,7 +20,9 @@ def alnum_gen(r, l=1): def fortune(r, max_len): all_fortunes = [] - for fortune_file in glob.glob('/usr/share/games/fortunes/*.u8'): + for fortune_file in itertools.chain( + glob.iglob('/usr/share/fortune/*.u8'), + glob.iglob('/usr/share/games/fortunes/*.u8')): f = open(fortune_file) l = f.read().split('\n%\n')[:-1] for i in l: -- cgit v1.2.1