I am trying to catch a signal and pass a variable to an exit handler.
The Python3 signal handling signal.signal(signal.SIGINT, exit_handler), which I use now, cannot pass a variable.
Here is my code:
import signal
def main(driver):
""
# somecode
def exit_handler(sig, frame):
driver.quit()
db.update
# etc
exit()
if __name__ == '__main__':
driver = ""
database = ""
signal.signal(signal.SIGINT, exit_handler) # pass variable to exit_handler
exit()
How to accomplish that?