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
Problems with OMPython and packages stored as a directory #489
When using ModelicaSystem in a package with multiple files (i.e. when the models are in different (sub)folders) the loading with OMCSession fails.
Steps to Reproduce
load the attached file, unpack it and try in a python console (with ompython installed of course) the following code:
from OMPython import ModelicaSystem
mod=ModelicaSystem("BouncingBalls/package.mo","BouncingBalls.Tests.StableBouncingBall")
-> Error:
[OMC log for 'sendExpression(expr=loadFile("/tmp/bfd53f62-ef57-4907-a983-b78f12dbd88a/package.mo"), parsed=True)']: [scripting:error:236] Expected the package to have name bfd53f62-ef57-4907-a983-b78f12dbd88a, but got BouncingBalls.
....
00: [scripting:error:236] [/tmp/bfd53f62-ef57-4907-a983-b78f12dbd88a/package.mo:false:2:1:18:18] Expected the package to have name bfd53f62-ef57-4907-a983-b78f12dbd88a, but got BouncingBalls.
01: [scripting:error:184] [:false:0:0:0:0] Failed to load package bfd53f62-ef57-4907-a983-b78f12dbd88a () using OPENMODELICALIBRARY (MODELICAPATH in the language specification) /tmp.
Expected Behavior
The model should load
Version and OS
OpenModelica 1.28.0~dev-744-ged53351
WSL (Ubuntu or Debian) on Windows 11
OMPython seems under heavy development (OMCSessionZMQ deprecated, undocumented OMCSession*, etc.). I could'nt find any information except in the source files. Would be nice to have this development somewhere documented and updated ;-)
🤖 Automated triage by Claude (an AI model by Anthropic), posted from @sjoelund's account. I re-tested this issue against a recent OpenModelica build and it appears to be resolved. The evidence is below so that a maintainer can verify it and close the issue. I have not closed anything myself.
Tested with:v1.28.0-dev.887+gff74690.cmake (Linux x86_64) and OMPython master 79d80ca (2026-10-05), installed with pip install git+https://github.com/OpenModelica/OMPython@master into a clean venv Original report:ModelicaSystem("BouncingBalls/package.mo", "BouncingBalls.Tests.StableBouncingBall") for a package stored as a directory failed. OMPython copied package.mo out of its package directory into a temporary directory, and omc then complained "Expected the package to have name , but got BouncingBalls".
Reproduction (attached BouncingBalls.zip extracted to dl/, unchanged):
Why this resolves the issue: the multi-file package loads, and the ModelicaSystem object is created with the model's quantities available. The fix is on the OMPython side: #476 ("fix loadFile for package.mo: don't copy it out of its package directory", merged 2026-10-02), as @arun3688 noted.
Activity
arun3688 commentedon Oct 2, 2026
@Ulfsen the issue should be fixed with this #476, please test it from the latest master, reopen the issue if you face problem
sjoelund commentedon Oct 9, 2026
Note
🤖 Automated triage by Claude (an AI model by Anthropic), posted from @sjoelund's account. I re-tested this issue against a recent OpenModelica build and it appears to be resolved. The evidence is below so that a maintainer can verify it and close the issue. I have not closed anything myself.
Tested with:
v1.28.0-dev.887+gff74690.cmake(Linux x86_64) and OMPython master 79d80ca (2026-10-05), installed withpip install git+https://github.com/OpenModelica/OMPython@masterinto a clean venvOriginal report:
ModelicaSystem("BouncingBalls/package.mo", "BouncingBalls.Tests.StableBouncingBall")for a package stored as a directory failed. OMPython copiedpackage.moout of its package directory into a temporary directory, and omc then complained "Expected the package to have name , but got BouncingBalls".Reproduction (attached
BouncingBalls.zipextracted todl/, unchanged):Result:
Why this resolves the issue: the multi-file package loads, and the
ModelicaSystemobject is created with the model's quantities available. The fix is on the OMPython side: #476 ("fix loadFile for package.mo: don't copy it out of its package directory", merged 2026-10-02), as @arun3688 noted.