flet-dev / serious-python

Python runtime for Flutter apps
Apache License 2.0
212 stars 22 forks source link

Kill python application #22

Closed SKbarbon closed 1 year ago

SKbarbon commented 1 year ago

I am using this package in non-flet purposes. Im facing a need of stopping/killing the python process. Is there a way or a planned way to do this? Its highly recommended because using "sys.exit()" or "os._exit()" is actually exiting the whole flutter app.

FeodorFitsner commented 1 year ago

I don't think "killing" Python process is a proper way to deal with that. serious_python runs Python in-process. You would need a way to communicate from Dart to Python that you'd like Python program to finish, like pipes, sockets. Take a look at Flet and flet_example - Flet starts a socket server on Python side and then connects to it from Dart.