Skip to content

Commit 0c32bf4

Browse files
Add the Apertium Binaries to Process' PATH while importing module
1 parent 2285633 commit 0c32bf4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

apertium/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,24 @@ def append_pair_path_windows(): # type (None) -> None
5050
append_pair_path(apertium_lang_path)
5151

5252

53+
def update_path_windows():
54+
'''Adding the Apertium Binaries to Process' PATH'''
55+
56+
if platform.system() == 'Windows':
57+
install_path = os.environ['LOCALAPPDATA']
58+
current = os.environ['path']
59+
60+
apertium_path = os.path.join(install_path, 'apertium-all-dev', 'bin')
61+
if os.path.isdir(apertium_path):
62+
update_path = '{};{};'.format(current, apertium_path)
63+
os.environ['path'] = update_path
64+
65+
5366
pair_paths = ['/usr/share/apertium', '/usr/local/share/apertium']
5467
analyzers = {} # type: Dict[str, Tuple[str, str]]
5568
generators = {} # type: Dict[str, Tuple[str, str]]
5669
pairs = {} # type: Dict[str, str]
5770
for pair_path in pair_paths:
5871
_update_modes(pair_path)
5972
append_pair_path_windows()
73+
update_path_windows()

0 commit comments

Comments
 (0)