diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-05-26 14:40:18 -0400 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-05-26 14:40:18 -0400 |
| commit | a24021d3ea2d2cab18cbb2bd1060c66d0a4ccc03 (patch) | |
| tree | 24ef8a3fc2203f68e7b0240e49e9c5866c602def /boot/vocabcompiler.py | |
| parent | f64d11bcb5fee53743cab9add2790c3c2de231d8 (diff) | |
| download | jasper-client-a24021d3ea2d2cab18cbb2bd1060c66d0a4ccc03.tar.gz jasper-client-a24021d3ea2d2cab18cbb2bd1060c66d0a4ccc03.zip | |
complete vocabcompiler fix
Diffstat (limited to 'boot/vocabcompiler.py')
| -rw-r--r-- | boot/vocabcompiler.py | 10 |
1 files changed, 8 insertions, 2 deletions
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 |
