background - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: background (/thread-34419.html) |
background - somboku - Jul-29-2021 Guys, first things first. HI - I am new here and to python. How can I do a job in the background while doing a different thing. Its just a small project for my Raspberry script simple: import python-forum-knowledge def main(): start_blink() # just let a led blink in a while loop if fetch_my_mails(): # nomen est omen stop_blink()I thought about subprocess.getstatusoutput, but this one is wating for an output of course. Some kind of threading inside the script? Ohhh yeah. the whole thing is runnging under daemon.DaemonContext So if you could push me in a direction - do it! Thanks. K. RE: background - jefsummers - Jul-29-2021 Have yet to use, but I'd be looking into asyncio. Python docs for async IO RE: background - somboku - Jul-31-2021 (Jul-29-2021, 07:33 PM)jefsummers Wrote: Have yet to use, but I'd be looking into asyncio. thanks man. messed around a bit with asyncIO, but it was a way too much found module "threading", that did the job easy. thanks anyway for the answer. cheers K. |