Home › Forum › SOFA › Programming with SOFA › [SOLVED] Could sofa use full Python instead of being embedded in XML file using component
Tagged: 64_bits, SOFA_1612, TetrahedralTensorMassForceField, Windows_7
- This topic has 7 replies, 3 voices, and was last updated 6 years, 11 months ago by
Damien Marchal.
-
AuthorPosts
-
1 November 2018 at 08:41 #12318
shang
Blockedhi,all
Does any one knows is it possible to step debug Python scene file instead of embedding the python script in xml.scn file using PythonScriptController?2 November 2018 at 16:47 #12321Hugo
KeymasterHi @xiaojuan
What do you mean exactly by “step debug Python scene file instead of embedding the python script” ?
BestHugo
3 November 2018 at 01:23 #12328shang
Blockedhi @Hugo
I mean loading the python scene file directly instead of call the python script using PythonScriptController in xml scene file.And step debugging is only allowed in cpp scene,right? I am thinking step debugging is simple in debugging a scene code.
14 November 2018 at 19:01 #12449Hugo
KeymasterHi @xiaojuan
Are you already using Python in your simulation?
You can write a scene only in a .py file and run it with runSofa. However, as soon as you need interactions during the simulation (or printing information for your debugging) you need a PythonScriptController.Another solution would be to compile SOFA in debug mode, not sure that’s what you want to do.
BestHugo
15 November 2018 at 03:15 #12458shang
BlockedThank you Hugo
I am exactly using python to interact with the scene, and need to print data to console platform. So, I used PythonScriptController component in xml.
I also tried to compile SOFA in debug mode in cpp project.However, it is very slow and time-consuming in compilation and debugging process.So,I gave up cpp compilation.23 November 2018 at 20:28 #12531Hugo
KeymasterAlright, shall we close this topic then?
24 November 2018 at 05:32 #12533shang
BlockedOK~
19 December 2018 at 23:37 #12628Damien Marchal
BlockedHi xiaojuan,
I’m not sure I fully understand your question but you can use the classical python debugger pdb for stepping into the python code.
Extract from the doc: https://docs.python.org/2/library/pdb.html
“””
The typical usage to break into the debugger from a running program is to insertimport pdb; pdb.set_trace()
at the location you want to break into the debugger. You can then step through the code following this statement, and continue running without the debugger using the c command.
“””I have never used it but I think it will do what you want.
-
AuthorPosts
- You must be logged in to reply to this topic.
