From a24021d3ea2d2cab18cbb2bd1060c66d0a4ccc03 Mon Sep 17 00:00:00 2001 From: schneefux Date: Mon, 26 May 2014 14:40:18 -0400 Subject: complete vocabcompiler fix --- boot/vocabcompiler.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'boot/vocabcompiler.py') diff --git a/boot/vocabcompiler.py b/boot/vocabcompiler.py index 70c1ea3..72691b0 100644 --- a/boot/vocabcompiler.py +++ b/boot/vocabcompiler.py @@ -5,9 +5,14 @@ import os import sys import pkgutil +import glob lib_path = os.path.abspath('../client') +mod_path = os.path.abspath('../client/modules/') + sys.path.append(lib_path) +sys.path.append(mod_path) + import modules import g2p @@ -17,12 +22,13 @@ def compile(): Gets the words and creates the dictionary """ - m = [name for _, name, _ in pkgutil.iter_modules(['modules'])] + m = [os.path.basename(f)[:-3] for f in glob.glob(os.path.dirname("../client/modules/")+"/*.py")] words = [] for module_name in m: try: - eval("words.extend(modules.%s.WORDS)" % module_name) + exec("import %s" % module_name) + eval("words.extend(%s.WORDS)" % module_name) except: pass # module probably doesn't have the property -- cgit v1.3.1