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
{{ message }}
Repository navigation
ModelicaSystem cannot load model from relative path #245
Note: If the model file is not in the current working directory, then the path where file is located must be included together with file name. Besides, if the Modelica model contains several different models within the same package, then in order to build the specific model, in second argument, user must put the package name with dot(.) followed by specific model name.
$ cd /usr/share/doc/omc/testmodels
$ ipython3
/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py:915: UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
warn(
Python 3.12.3 (main, Feb 4 2025, 14:48:35) [GCC 13.3.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.20.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from OMPython import ModelicaSystem
In [2]: mod = ModelicaSystem("BouncingBall.mo", "BouncingBall")
2025-04-07 11:31:12,386 - OMPython - ERROR - Error: Failed to load package BouncingBall (default) using MODELICAPATH /home/ondra/.openmodelica/libraries/.
Error: Class BouncingBall not found in scope <top>.
2025-04-07 11:31:12,386 - OMPython - ERROR - XML file not generated:
In [3]: from pathlib import Path
In [4]: mod = ModelicaSystem(str(Path("BouncingBall.mo").resolve()), "BouncingBall")
In [5]:
Activity
[-]ModelicaModel cannot load model from relative path[/-][+]ModelicaSystem cannot load model from relative path[/+]Fix ModelicaSystem cannot load from relative path
Fix ModelicaSystem cannot load from relative path
Fix ModelicaSystem cannot load from relative path
Fix ModelicaSystem cannot load from relative path
Fix ModelicaSystem cannot load from relative path (OpenModelica#247)