From d8daa57a332b8b99d8adb844830336ebbb299b4d Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 7 Feb 2020 00:23:48 -0500 Subject: [PATCH] Add script "guards" to docs examples This was originally bundled in #102 but the windows CI there has blocked that from landing quickly. These examples need to be fixed stat since I've had at least a couple people notice it now when first trying out the project. --- README.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index f97b623..2dabf6b 100644 --- a/README.rst +++ b/README.rst @@ -146,7 +146,8 @@ the hip new film we're shooting: print("CUTTTT CUUTT CUT!!! Donny!! You're supposed to say...") - tractor.run(main) + if __name__ == '__main__': + tractor.run(main) We spawn two *actors*, *donny* and *gretchen*. @@ -192,7 +193,9 @@ and use the ``run_in_actor()`` method: print(await portal.result()) - tractor.run(main) + + if __name__ == '__main__': + tractor.run(main) What's going on?