2

I am running the Python program to call the other 3rd module, which may written in C. In this case, how can I recover from the Segmentation fault and continue to process others in a loop?

Segmentation Fault is not exception so that cannot be catched. And I already know the root of Segmentation Fault and needn't to trace it. (python tracing a segmentation fault)

Community
  • 1
  • 1
northtree
  • 8,569
  • 11
  • 61
  • 80

2 Answers2

4

Call the third module in another process, so it doesn't crash the main one when segfault occurs.

MatthieuW
  • 2,292
  • 15
  • 25
2

A segmentation fault might be a bug in that C module you are calling from you Python program. If you own the code and know the reason for the segmentation fault, it would be better to fix it instead of skipping the current iteration and continuing with others in the loop because this segmentation fault would have blown off the memory and you might not get the desired results.

Sanish
  • 1,699
  • 1
  • 12
  • 21