diff options
Diffstat (limited to 'kpov_judge/kpov_random_helpers.py')
-rwxr-xr-x | kpov_judge/kpov_random_helpers.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kpov_judge/kpov_random_helpers.py b/kpov_judge/kpov_random_helpers.py index 9775224..0a25d00 100755 --- a/kpov_judge/kpov_random_helpers.py +++ b/kpov_judge/kpov_random_helpers.py @@ -9,6 +9,7 @@ import math import re import subprocess import glob +import os def alnum_gen(r, l=1): s = u"" @@ -85,11 +86,12 @@ def fname_gen(r, extension = True): s += '.' + r.choice(common_file_extensions) return s -with open('random_data/greek_gods.txt') as f: +fdir = os.path.dirname(os.path.realpath(__file__)) +with open(os.path.join(fdir, 'random_data/greek_gods.txt')) as f: greek_gods = [i.strip() for i in f.readlines()] -with open('random_data/roman_gods.txt') as f: +with open(os.path.join(fdir, 'random_data/roman_gods.txt')) as f: roman_gods = [i.strip() for i in f.readlines()] -with open('random_data/slavic_gods.txt') as f: +with open(os.path.join(fdir, 'random_data/slavic_gods.txt')) as f: slavic_gods = [i.strip() for i in f.readlines()] gods = greek_gods + roman_gods + slavic_gods @@ -97,10 +99,10 @@ gods = greek_gods + roman_gods + slavic_gods def hostname_gen(r): return "{0}-{1:02}".format(r.choice(gods), r.randint(1, 99)) -with open('random_data/slovenian_names.txt') as f: +with open(os.path.join(fdir, 'random_data/slovenian_names.txt')) as f: names = [i.strip() for i in f.readlines()] -with open('random_data/slovenian_surnames.txt') as f: +with open(os.path.join(fdir, 'random_data/slovenian_surnames.txt')) as f: surnames = [i.strip() for i in f.readlines()] def username_gen(r): |