Run atexit() when python process is killed

前端 未结 3 1646
小蘑菇
小蘑菇 2021-02-05 11:38

I have a python process which runs in background, and I would like it to generate some output only when the script is terminated.

def handle_exit():
    print(\'         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-05 12:37

    To enable signals when debugging PyCharm on Windows:

    1. Within PyCharm hit Ctrl + Shift + A to bring up the "Find Actions..." menu
    2. Search for "Registry" and hit enter
    3. Find the key kill.windows.processes.softly and enable it (you can start typing "kill" and it will search for the key)
    4. Restart PyCharm

提交回复
热议问题