This is my code:
if __name__ == "__main__":
try:
main()
except Exception:
exc_info = sys.exc_info()
traceback.print_exception(*exc_info)
os.killpg(0, signal.SIGKILL)
exit(0)
When an exception occurs in the program, I want to use the killpg method of the os module to terminate the current process, but an error message
AttributeError: module 'os' has no attribute 'killpg'
appears. I am using Python version 3.7.
Can you help me solve this problem? Thank you very much.
maybe your python version is 2.x you can modify your code and retry, use "os.kill()"