[Python] Memory error on python import does not stop execution

Discussão em 'Python' iniciado por Stack, Maio 30, 2025.

  1. Stack

    Stack Membro Participativo

    I have run into a strange situation in one of the work environments.

    In the beginning of the work of the python script during the import of openpyxl modules sometimes i run into MemoryError. But what happens is that a trace is printed out in console, but my code just continues executing. it seems the erorr is not propagated to my handlers.

    Out of memory situation has its reasons beyond my reach, and it has to do with the workload of machine where the script is executing.

    However, what i would like to have is to be able to handle that error and by handle i mean emergency stop myprogram and log the reasons. Even falling with unhandled memoryError would be preferable. how can i achieve that?

    Here is what i get printed in my console window:

    [​IMG]

    I must reiterate that execution of the script continues. I would prefer it did not.

    Continue reading...

Compartilhe esta Página