You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@PT-Traviresta the issue is fixed with this commit 59ff73b, Thanks for the contribution, i will close this issue, please open the issue in case you face any problem
I am on v3.6.0 and python 3.13.2 and in OMPython's pyproject.toml it says version = "3.6.0", so that seems to be the latest one?
Which version should I install instead?
here my mwe:
from OMPython import OMCSessionZMQ
from OMPython import ModelicaSystem
omc = OMCSessionZMQ()
model_path=omc.sendExpression("getInstallationDirectoryPath()") + "/share/doc/omc/testmodels/"
mod1 = ModelicaSystem(model_path + "BouncingBall.mo","BouncingBall")
mod1.linearize()
output:
SyntaxError Traceback (most recent call last)
File c:\Users\mfranke\Documents\projects\general_python\.venv\Lib\site-packages\OMPython\__init__.py:1776, in ModelicaSystem.linearize(self, lintime, simflags)
1773 try:
1774 ## do not add the linearfile directory to path, as multiple execution of linearization will always use the first added path, instead execute the file
1775 ## https://github.com/OpenModelica/OMPython/issues/196
-> [1776](file:///C:/Users/mfranke/Documents/projects/general_python/.venv/Lib/site-packages/OMPython/__init__.py:1776) module = importlib.machinery.SourceFileLoader("linearized_model", linearFile).load_module()
1777 result = module.linearized_model()
File <frozen importlib._bootstrap_external>:680, in _check_name_wrapper(self, name, *args, **kwargs)
File <frozen importlib._bootstrap_external>:1207, in load_module(self, fullname)
File <frozen importlib._bootstrap_external>:1031, in load_module(self, fullname)
File <frozen importlib._bootstrap>:537, in _load_module_shim(self, fullname)
File <frozen importlib._bootstrap>:966, in _load(spec)
File <frozen importlib._bootstrap>:935, in _load_unlocked(spec)
File <frozen importlib._bootstrap_external>:1022, in exec_module(self, module)
File <frozen importlib._bootstrap_external>:1160, in get_code(self, fullname)
...
-> [1786](file:///C:/Users/mfranke/Documents/projects/general_python/.venv/Lib/site-packages/OMPython/__init__.py:1786) raise Exception("ModuleNotFoundError: No module named 'linearized_model'")
1787 else:
1788 errormsg = self.getconn.sendExpression("getErrorString()")
Exception: ModuleNotFoundError: No module named 'linearized_model'
@syntron is this because of some latest changes in working directory handling? The model.bat file should be created.
@martinscripts any idea which OpenModelica version you are using? Can you show us which files are generated in C:\Users\mfranke\AppData\Local\Temp\tmph422rspr
@martinscripts i guess you are using older OpenModelica version, if i remember it correctly OpenModelica 1.23 or earlier version generates linearization file with different pattern, I guess the new changes might have removed the check for older openmodelica version i guess, if that is the case please install the latest openmodelica version and test it
Hey, yes, you are right, I am on OM 1.18, so quite old.
I am not able to test it with the new versin right now, but I find your explanation plausible. If it persists for newer versions in the future, we can still reconvene.
Thank you and best regards
Hey, yes, you are right, I am on OM 1.18, so quite old.
I am not able to test it with the new versin right now, but I find your explanation plausible. If it persists for newer versions in the future, we can still reconvene.
Thank you and best regards
With the newer version this should work by default, So I will close this issue, please reopen it incase if you face problems with the latest openmodelica version
Activity
arun3688 commentedon Feb 28, 2024
@PT-Traviresta usually it should not be problem because the session is running in the directory where the linearized file is created
PT-Traviresta commentedon Feb 29, 2024
@arun3688
If I run the script line-by-line in the interactive mode, there's no problem. But if I run it in the script mode, the error occurs.
My colleague also faced the same problem.
arun3688 commentedon Feb 29, 2024
@PT-Traviresta the issue is fixed with this commit 59ff73b, Thanks for the contribution, i will close this issue, please open the issue in case you face any problem
martinscripts commentedon Aug 19, 2025
I get the same error on python 3.13.2 with OMPython 3.6.0
adeas31 commentedon Aug 19, 2025
@syntron can you please test this. I believe this should work in master after the changes you have done.
syntron commentedon Aug 19, 2025
@martinscripts could you please re-test with the latest version? This should not happen at all as the linearized file is no longer imported!
For the old version - 3.6.0 - the error is still valid as the change was merged after this!
martinscripts commentedon Aug 20, 2025
Hey @syntron,
I am on v3.6.0 and python 3.13.2 and in OMPython's pyproject.toml it says
version = "3.6.0", so that seems to be the latest one?Which version should I install instead?
here my mwe:
output:
adeas31 commentedon Aug 20, 2025
By latest version we mean installing OMPython from latest source https://github.com/OpenModelica/OMPython?tab=readme-ov-file#via-source
martinscripts commentedon Aug 20, 2025
ok, thanks.
I did
pip install git+https://github.com/OpenModelica/OMPython.gitnow, which I assume should do the same?With the same mwe from above, I now get
adeas31 commentedon Aug 20, 2025
@syntron is this because of some latest changes in working directory handling? The
model.batfile should be created.@martinscripts any idea which OpenModelica version you are using? Can you show us which files are generated in
C:\Users\mfranke\AppData\Local\Temp\tmph422rsprarun3688 commentedon Aug 20, 2025
@martinscripts i guess you are using older OpenModelica version, if i remember it correctly OpenModelica 1.23 or earlier version generates linearization file with different pattern, I guess the new changes might have removed the check for older openmodelica version i guess, if that is the case please install the latest openmodelica version and test it
martinscripts commentedon Aug 20, 2025
Hey, yes, you are right, I am on OM 1.18, so quite old.
I am not able to test it with the new versin right now, but I find your explanation plausible. If it persists for newer versions in the future, we can still reconvene.
Thank you and best regards
arun3688 commentedon Aug 20, 2025
With the newer version this should work by default, So I will close this issue, please reopen it incase if you face problems with the latest openmodelica version