![]() If starting a separate thread make sure the thread doesn’t share resources with the skill object since this will hinder garbage collection when the skill is reloaded. You can start a process and detatch it once and then check if the process is running (either communication or search for running processes) The run () function is the recommended method of using subprocess. If the process don’t need to outlive the skill I recommend starting the process in the _init_() method and having a custom shutdown method (override shutdown()) that terminates the subprocess in a neat way (I don’t always practice what I preach) Let’s get started The n () Function The run () function was added in Python 3.5. The limit argument sets the buffer limit for StreamReader wrappers for Process.stdout and Process.stderr (if subprocess. I assume you want the process to outlive the skill start/shutdown?įor ease of installation an already running daemon is most likely not practical, since the normal skill install method doesn’t accommodate for installing custom services. So it would look like this: import subprocess n('python', 'myscript.py') Its also possible to write Python code directly to the function instead of passing a. There are however bad and good ways of doing this This is a great topic that may need some discussion as there are no firm rules or regulations ( anything goes).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |