Skip to content

How to catch MapdlExitedError #3728

Answered by saitade-bh
imhsaq asked this question in Q&A
Feb 7, 2025 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

from ansys.mapdl.core.errors import MapdlExitedError
Then catch the MapdlExitedError. What I would suggest is to put all your mapdl commands within a function and iterate the execution of function in your for loop. It's important to restart your mapdl instance after it has been exited by the error.
Example:

 mapdl = launch_mapdl()
 try:
         with mapdl.non_interactive:
            mapdl.run(f"/com, Running load case: {start_case}")
            mapdl.run(f"icase={start_case}")
 except MapdlExitedError:
         #rerun the function again after relaunching the mapdl instance again

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@imhsaq
Comment options

@imhsaq
Comment options

Answer selected by germa89
Comment options

You must be logged in to vote
1 reply
@imhsaq
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants