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
I'm not sure I understand your issue. Which warning, the one emitted by msg_warning(...) in SOFA? I'm not seeing the link with exceptions triggered by python.
Do you have a minimal reproducible example? That would be very useful.
This example generates the following warning (which is actually hard to link to the problematic line of code):
[WARNING] [Prefab_Trampoline(VisualModel)] Prefab instantiated. Check for required prefab parameters to fully populate
and the creation of the scene will just stop at this stage. I've had other similar issues, the creation of the scene would just stop without any python error. It's a shame I can't remember/reproduce the other problems I had. I don't think they are all related to this warning in doReInit(), but yeah I'm not sure.
I just tried your example. While I do get the warning, I'm not having any crash. Are you up-to-date with the master branch of SofaPython3? We fixed many bugs related to inheriting C++ classes in Python recently.
The warning seems to happen because Prefab::init() calls the Prefab::reinit() (1) before setting its "m_is_initialized" member to true (2):
I never used the Prefab so I'm not sure of the impact here, although looking very quickly through this part of the code, it doesn't seems too dangerous.
When a warning is raised by Sofa, the creation of the scene stops.
After a discussion with Damien, it seems that SofaPython3 should catch python3's exceptions, the same way it was done in SofaPython plugin.
If I understood correctly it wasn't possible with python 3.8 but it should be with the new release 3.9.
I think there is two issue mixed together.
One is about the exception risen from python. In SofaPython they were catched by a dedicated hook installed by Sofa in the python interpreter. Because of multithreading this feature was broken before 3.8 and thus SofPython3 was not using it. The consequence is that when there is an error at the python level the behavior is different.
The other is the error message relative to prefab. @jnbrunet gave a proper answer here.
Activity
jnbrunet commentedon Jan 19, 2021
Hey @EulalieCoevoet ,
I'm not sure I understand your issue. Which warning, the one emitted by
msg_warning(...)in SOFA? I'm not seeing the link with exceptions triggered by python.Do you have a minimal reproducible example? That would be very useful.
EulalieCoevoet commentedon Jan 19, 2021
You're right I'm mixing different things, and I've opened this issue a bit too fast. Sorry for that, let's do it again.
I've noticed that the creation of the scene would stop really often (compared to SofaPython). For instance, if I change a property of a prefab:
This example generates the following warning (which is actually hard to link to the problematic line of code):
and the creation of the scene will just stop at this stage. I've had other similar issues, the creation of the scene would just stop without any python error. It's a shame I can't remember/reproduce the other problems I had. I don't think they are all related to this warning in doReInit(), but yeah I'm not sure.
jnbrunet commentedon Jan 21, 2021
Hey @EulalieCoevoet ,
I just tried your example. While I do get the warning, I'm not having any crash. Are you up-to-date with the master branch of SofaPython3? We fixed many bugs related to inheriting C++ classes in Python recently.
The warning seems to happen because
Prefab::init()calls thePrefab::reinit()(1) before setting its "m_is_initialized" member to true (2):Prefab::reinit()will call the trampolinedoReInitfunction, which emits a warning if "m_is_initialized" is false...Could you try changing the order of the calls (1) and (2) like this:
I never used the Prefab so I'm not sure of the impact here, although looking very quickly through this part of the code, it doesn't seems too dangerous.
EulalieCoevoet commentedon Jan 25, 2021
Yep, that solves it.
damienmarchal commentedon Jan 26, 2021
I think there is two issue mixed together.
One is about the exception risen from python. In SofaPython they were catched by a dedicated hook installed by Sofa in the python interpreter. Because of multithreading this feature was broken before 3.8 and thus SofPython3 was not using it. The consequence is that when there is an error at the python level the behavior is different.
The other is the error message relative to prefab. @jnbrunet gave a proper answer here.
jnbrunet commentedon Jan 26, 2021
All right, yeah I remember vaguely about this. I created #106 in order to follow the former issue.