OMPython
OMPython copied to clipboard
Release 3.2.0 produces [WinError 193] %1 is not a valid Win32 application
Hi, I get the error in subject on Release 3,2,0 when calling "omc = OMCSessionZMQ()". The error does not appear using Release 3.1.2.
Difference is in the use of "shell=True" param in _start_omc_process(self):
Release 3.2.0:
self._omc_process = subprocess.Popen(self._omc_command, stdout=self._omc_log_file, stderr=self._omc_log_file, env=my_env)
Release 3.1.2:
self._omc_process = subprocess.Popen(self._omc_command, , shell=True. stdout=self._omc_log_file, stderr=self._omc_log_file, env=my_env)
To avoid this error in Release 3.2.0 (where shell=True is not used), pathname should not be included in self._omc_command (path for omc executable is already present in the PATH environment variable):
subprocess.call(['E:\\OpenModelica1.14.1-64bit\\bin\\omc', '--interactive=zmq', '+z=cb80c01b43984c4285cf60ffd9b66294'])
--> [WinError 193] %1 is not a valid Win32 application
subprocess.call(['omc', '--interactive=zmq', '+z=cb80c01b43984c4285cf60ffd9b66294'])
--> OK!