'Fatal Python Error - Read stats from file - Exception doesnt work

My Python scripts crashes sometimes while reading the stats from a file (last edit time). Sometimes it works for days, sometimes it crashes every hour. I can’t reproduce the bug :( I tried to solve it with try except but the script simply crashes

Fatal Python error: (pygame parachute) Segmentation Fault

Code:

    try:
        stat = os.stat(self.pathDB+""+fileName+".txt")  
    except OSError as e:    
        print("OS ERROR - : %s" % e)
        return False            
    except Exception as e:
        print("FATAL ERROR - TEST: %s" % e)
        return False

Does anyone has an idea how to solve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source