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
My code sometimes throws Exceptions of type MapdlExitedError.
I tried to catch them with try except-blocks, but that did not work as I supposed it should do.
When starting mapdl with launch_mapdl an empty toolbar-icon appears for the started Distributed Mechanical APDL application. When closing mapdl with mapdl.exit() this icon normally disappears.
My first understanding was:
MapdlExitedError closes mapdl like mapdl.exit() does, so I have to relaunch again.
But apparently the toolbar icon does not disappear and a new launch_mapdl-command opens a new one. The more icons I see, the longer is the time the new launch takes and I made the experience that too many open applications may make IDE crash.
I put these try except blocks inside loops and write the launch_mapdl command inside the exception block.
According to where the crash occurs, my idea was to set up the system again with the corresponding mapdl commands, so that for the next loop iteration I will get the correct input data.
But that does not seem to work. As said, all the icons in the toolbar stay open and I have to close all the tasks manually with the Windows Task Manager (see attached Word-file). 250207_MapdlExitedError.docx
As I have many iterations that might fail this is not feasible.
I even tried to explicitly exit by writing an mapdl.exit() command before the lauch_mapdl command, but that does not work either.
The structure is like this:
def fun_checkError(...):
if-statements to check where error occurs:
launch_mapdl
execute necessary mapdl commands (according to if-statements) to set up the system again for next loop iteration
main:
launch_mapdl
try:
execute some mapdl commands
for loop1: (this loop appears in a separate function)
try:
execute mapdl commands
except:
fun_checkError
pass
execute some mapdl commands
for loop2: (this loop appears in a separate function)
try:
execute mapdl commands
except:
fun_checkError
pass
except:
mapdl.exit()
In my last run the error occurred inside loop 1, the programme continued to run until the end of the loop, throwing MapdlExitedError at each iteration,
which were ignored according to the pass and then the first mapdl-command before loop2 (loading a rst-file), which never fails, ended up the programm with another
MapdlExitedError branching to the ultimate except
So I got no idea, how I could really catch a MapdlExitedError and continue my programme to run. Seemingly after the first MapdlExitedError thrown there is no way to catch it properly.
What is behind this error concept? Is there a strategy one should follow?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
My code sometimes throws Exceptions of type MapdlExitedError.
I tried to catch them with try except-blocks, but that did not work as I supposed it should do.
When starting mapdl with launch_mapdl an empty toolbar-icon appears for the started Distributed Mechanical APDL application. When closing mapdl with mapdl.exit() this icon normally disappears.
My first understanding was:
MapdlExitedError closes mapdl like mapdl.exit() does, so I have to relaunch again.
But apparently the toolbar icon does not disappear and a new launch_mapdl-command opens a new one. The more icons I see, the longer is the time the new launch takes and I made the experience that too many open applications may make IDE crash.
I put these try except blocks inside loops and write the launch_mapdl command inside the exception block.
According to where the crash occurs, my idea was to set up the system again with the corresponding mapdl commands, so that for the next loop iteration I will get the correct input data.
But that does not seem to work. As said, all the icons in the toolbar stay open and I have to close all the tasks manually with the Windows Task Manager (see attached Word-file).
250207_MapdlExitedError.docx
As I have many iterations that might fail this is not feasible.
I even tried to explicitly exit by writing an mapdl.exit() command before the lauch_mapdl command, but that does not work either.
The structure is like this:
In my last run the error occurred inside loop 1, the programme continued to run until the end of the loop, throwing MapdlExitedError at each iteration,
which were ignored according to the pass and then the first mapdl-command before loop2 (loading a rst-file), which never fails, ended up the programm with another
MapdlExitedError branching to the ultimate except
So I got no idea, how I could really catch a MapdlExitedError and continue my programme to run. Seemingly after the first MapdlExitedError thrown there is no way to catch it properly.
What is behind this error concept? Is there a strategy one should follow?
Beta Was this translation helpful? Give feedback.
All reactions