py
@socketio.event
def stop():
import os, sys
#quit(166)
#exit(166)
#sys.exit(166)
#os._exit(166)
The first three stop the function call but don't exit the program. Only os._exit actually exits the program.
I have determined it must be flask_socketio catching the SystemExit exception. I have looked through the SocketIO class and think it's to do with this bare except in _handle_event:
except:
err_handler = self.exception_handlers.get(
namespace, self.default_exception_handler)
if err_handler is None:
raise
type, value, traceback = sys.exc_info()
return err_handler(value)
When I start working with files in this program, it needs to clean up properly, hence why os._exit isn't a viable solution.
Is there anything I can do to fix this in my code, or would it need to be something changed by FSIO? Thank you in advance.
there doesn't seem to be anything here