the top-level directory, default is `True`. ignore_permission_denied: if `True`, will ignore permission denied errors, otherwise will raise them by default. Setting the `WATCHFILES_IGNORE_PERMISSION_DENIED` environment variable will set this value too. Yields: The generator yields sets of [`FileChange`][watchfiles.main.FileChange]s. ```py title="Example of awatch usage" import asyncio from watchfiles import awatch async def main(): async for changes in awatch('./first/dir', './second/dir'): print(changes) if __name__ == '__main__': try: asyncio.run(main()) except KeyboardInterrupt: print('stopped via KeyboardInterrupt') ``` ```py title="Example of awatch usage with a stop event" import asyncio from watchfiles import awatch async def main(): stop_event = asyncio.Event() async def stop_soon(): await asyncio.sleep(3) stop_event.set() stop_soon_task = asyncio.create_task(stop_soon()) async for changes in awatch('/path/to/dir', stop_event=stop_event): print(changes) # cleanup by awaiting the (now complete) stop_soon_task await stop_soon_task asyncio.run(main()) ``` NzÄraise_interrupt is deprecated, KeyboardInterrupt will cause this coroutine to be cancelled and then be raised by the top level asyncio.run call or equivalent, and should be caught there. See #136.c