class MyState:

    def __init__(self):
        self.count = 1

def stop_handler(signum, frame):
    global running
running = False
signal.signal(signal.SIGINT, stop_handler)
running = True
state_filename = 'state.txt'
if os.path.isfile(state_filename):
    with open(state_filename, 'rb') as f_state:
        pass
Prime number hard drive storage for very large primes - Sieve of Atkin