Re: [petsc-users] Error handling in petsc4py

2023-11-27 Thread Jose E. Roman
The exception has been caught and the execution reaches the print() statement. I think you just need to disable the PETSc error handler, try with this: PETSc.Sys.pushErrorHandler("ignore") Jose > El 27 nov 2023, a las 16:41, Barry Smith escribió: > > > I see > > cdef extern from * nog

Re: [petsc-users] Error handling in petsc4py

2023-11-27 Thread Barry Smith
I see cdef extern from * nogil: ctypedef enum PetscErrorCode: PETSC_SUCCESS PETSC_ERR_PLIB PETSC_ERR_SUP PETSC_ERR_USER PETSC_ERR_MEM PETSC_ERR_MPI PETSC_ERR_PYTHON ctypedef enum PetscErrorType: PETSC_ERROR_INITIAL PETSC_ERROR_REPEAT cdef PetscErrorCode

Re: [petsc-users] Error handling in petsc4py

2023-11-27 Thread Miguel Angel Salazar de Troya
Hello, Is there any way to get the PETSc error codes in the python interface? The test I provided below is just a simple example that I know will run out of memory. Miguel On Wed, Nov 15, 2023 at 10:00 AM Miguel Angel Salazar de Troya < miguel.sala...@corintis.com> wrote: > Hello, > > The follo

[petsc-users] Error handling in petsc4py

2023-11-15 Thread Miguel Angel Salazar de Troya
Hello, The following simple petsc4py snippet runs out of memory, but I would like to handle it from python with the usual try-except. Is there any way to do so? How can I get the PETSc error codes in the python interface? Thanks from petsc4py import PETSc import sys, petsc4py petsc4py.init(sys.a