Skip to content

Commit 471a155

Browse files
committed
Set the environment for omc process.
1 parent 9abee95 commit 471a155

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎OMPython/__init__.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,14 @@ def _create_omc_log_file(self, suffix):
134134
self._omc_log_file = open(os.path.join(self._temp_dir, "openmodelica.{0}.{1}.{2}.log".format(self._currentUser, suffix, self._random_string)), 'w')
135135

136136
def _start_omc_process(self):
137-
self._omc_process = subprocess.Popen(self._omc_command, shell=True, stdout=self._omc_log_file, stderr=self._omc_log_file)
137+
if sys.platform == 'win32':
138+
omhome_bin = os.path.join(self.omhome, 'bin').replace("\\","/")
139+
my_env = os.environ.copy()
140+
my_env["PATH"] = omhome_bin + os.pathsep + my_env["PATH"]
141+
print my_env
142+
self._omc_process = subprocess.Popen(self._omc_command, shell=True, stdout=self._omc_log_file, stderr=self._omc_log_file, env=my_env)
143+
else:
144+
self._omc_process = subprocess.Popen(self._omc_command, shell=True, stdout=self._omc_log_file, stderr=self._omc_log_file)
138145
return self._omc_process
139146

140147
def _set_omc_command(self, omc_path, args):

0 commit comments

Comments
 (0)