Description
The documentation says that
|
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. |
However, this doesn't work in practice:
$ 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]:
Version and OS
- Python Version: 3.12.3
- OMPython Version: 5904e4e
- OpenModelica Version: 1.25.0
- OS: Ubuntu 24.04.2 LTS
Additional Context
I think I'll try to fix this myself and submit a pull request.
Description
The documentation says that
OMPython/OMPython/__init__.py
Line 660 in 5904e4e
However, this doesn't work in practice:
Version and OS
Additional Context
I think I'll try to fix this myself and submit a pull request.