title: How to handle a segmentation fault occurred in python
body: <p>I have written a piece of code that checks in a system if there is a new entry in the database or not if a new entry is found it will fetch the data and client will try to send it to the server ... but if data is continuously found in every execution of threading.timer cycle it will try to send it to the server...</p>
  
  <p>Now issue is if the server is unreachable then it will print that server is not alive etc. if this cycle goes for few minutes the script just crash and it shows Segmentation Fault ... i want to handle this exception and wanted to process something if Segmentation fault occurs</p>
  
  <p>working environment:
  linux
  python3
  sql-server</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This is what shows after script gets crashed...</p>
  
  <pre><code>Fatal Python error: Segmentation fault
  
  Thread 0xb3dff460 (most recent call first):
  
  File "/usr/lib/python3.4/threading.py", line 294 in wait File "/usr/lib/python3.4/threading.py", line 553 in wait File "/usr/lib/python3.4/threading.py", line 1184 in run File "/usr/lib/python3.4/threading.py", line 920 in _bootstrap_inner File "/usr/lib/python3.4/threading.py", line 888 in _bootstrap
  
  Current thread 0xb33ff460 (most recent call first):
    File "abc.py", line 343 in send_to_server
    File "abc.py", line 244 in sql_connect1
    File "/usr/lib/python3.4/threading.py", line 1186 in run
    File "/usr/lib/python3.4/threading.py", line 920 in _bootstrap_inner
    File "/usr/lib/python3.4/threading.py", line 888 in _bootstrap
  
  Thread 0xb45ff460 (most recent call first):
    File "abc.py", line 408 in send_to_server
    File "abc.py", line 244 in sql_connect1
    File "/usr/lib/python3.4/threading.py", line 1186 in run
    File "/usr/lib/python3.4/threading.py", line 920 in _bootstrap_inner
    File "/usr/lib/python3.4/threading.py", line 888 in _bootstrap
  
  Thread 0xb4fff460 (most recent call first):
    File "abc.py", line 343 in send_to_server
    File "abc.py", line 244 in sql_connect1
    File "/usr/lib/python3.4/threading.py", line 1186 in run
    File "/usr/lib/python3.4/threading.py", line 920 in _bootstrap_inner
    File "/usr/lib/python3.4/threading.py", line 888 in _bootstrap
  
  Thread 0xb6f39300 (most recent call first):
    File "/usr/lib/python3.4/threading.py", line 1076 in _wait_for_tstate_lock
    File "/usr/lib/python3.4/threading.py", line 1060 in join
    File "/usr/lib/python3.4/threading.py", line 1294 in _shutdown
  Segmentation fault
  </code></pre>