New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenCOR crashes due to a wrong assignment using Python #2526
Comments
Thanks for the report @WeiweiAi. It would be nice if you could provide me with whatever files are known to reproduce the problem. It will not only save me time while working on your issue, but also if I ever need to come back to this issue. |
Hi Alan,
You could clone this workspace
https://models.physiomeproject.org/workspace/64f to the local machine.
There is a file "originalFig12_sim.py" under the folder sed-ml. You could
modify line 40 as below :
original line 40: data.states()['outputs/V'] = iV_initial
Change line 40 to: data.states()['outputs/V'] = V_initial
Save the modification and in the OpenCOR Python console:
In [1]: cd path/to/folder_this_file_is_in
In [2]: run originalFig12_sim.py
It should reproduce the problem.
Thanks.
Best regards,
Weiwei
…On Tue, 10 Aug 2021 at 17:07, Alan Garny ***@***.***> wrote:
Thanks for the report @WeiweiAi <https://github.com/WeiweiAi>. It would
be nice if you could provide me with whatever files are known to reproduce
the problem. It will not only save me time while working on your issue, but
also if I ever need to come back to this issue.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2526 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADRVM42XOXNP7QEHFUUMH3DT4CXXNANCNFSM5B3JAW6Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
This is not working for me. Your workspace has been cloned to cd /Users/Alan/Desktop/64f/sed-ml
run originalFig12_sim.py which results in:
From there, I tried to run the script from the command line (the preferred option for me): cd /Users/Alan/Desktop/64f/sed-ml
[PathToOpenCOR]/pythonshell originalFig12_sim.py and I am getting a crash... but I am getting a crash with your both your original script and the modified one. So, at this stage, I can't reproduce your problem. |
FTR, the problem was that the workspace contains a Git submodule which wasn't initialised. Once initialised, I can reproduce the problem as described by @WeiweiAi. Now, the question is whether we can catch a Python "error" and thus prevent OpenCOR from crashing... |
AFAIK we do check for Python errors and respond appropriately... I'm guessing that the underlying fault will be in a wrapper around one of our OpenCOR classes. In particular I understand the crash happens with:
which is when a |
…hat a number is indeed a number (opencor#2526).
Yes, I know exactly where the problem occurs: here. Looking at the code, the obvious fix seems to be this one, which now results in OpenCOR behaving better: |
Looks good to close, thanks! |
Great, thanks. |
Basic info: Window 10, OpenCOR Snapshot 2021-05-19
Description:
The crash is caused by a mistake of assignment using Python. It has nothing to do with any particular model.
Here is an example of a Python script:
The OpenCOR crashes whenever running the above Python script.
There is a mistake in the example, and it is supposed to be
or
After the correction, the simulation works fine.
It would be good if the OpenCOR throws an error instead of crashing when encountering the error like in the example.
Thanks.
The text was updated successfully, but these errors were encountered: